unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* (define-module (foo) #:import (...)), a la r6rs
@ 2011-07-28 10:37 Andy Wingo
  2011-07-28 21:23 ` Ludovic Courtès
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Andy Wingo @ 2011-07-28 10:37 UTC (permalink / raw)
  To: guile-devel

Hi,

I was hacking on Dorodango today, in a script that happened to have a
Guile-style (define-module ...) block, and I was importing pieces of an
rnrs library.  Then I needed to update the import set to provide what
was needed.  In the middle of making a keyboard macro to add
#:use-module before the library names, I realized that `library' is
actually a lot better in this regard, in that you just have one `import'
block, and all the libraries are listed there without having a prefix on
each one.

So what do you all think about:

  (define-module (foo)
    #:import ((bar)
              (only (baz) qux foo)
              ...))

Or even:

  (define-module (foo)
    (import (bar)
            (only (baz) qux foo)
            ...))

We would continue to support the #:use-module syntax indefinitely, of
course.

It looks like the upcoming R7RS standard will support these import specs
in the same way as the r6rs, though without version specifiers
(thankfully).

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-07-28 10:37 (define-module (foo) #:import (...)), a la r6rs Andy Wingo
@ 2011-07-28 21:23 ` Ludovic Courtès
  2011-11-09 23:08   ` Andy Wingo
  2011-07-28 21:40 ` Mike Gran
  2011-07-28 21:52 ` Jose A. Ortega Ruiz
  2 siblings, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2011-07-28 21:23 UTC (permalink / raw)
  To: guile-devel

Hi!

Andy Wingo <wingo@pobox.com> skribis:

> So what do you all think about:
>
>   (define-module (foo)
>     #:import ((bar)
>               (only (baz) qux foo)
>               ...))
>
> Or even:
>
>   (define-module (foo)
>     (import (bar)
>             (only (baz) qux foo)
>             ...))

I’d prefer #:use-modules (plural), for consistency:

  (define-module (foo)
    #:use-modules ((bar)
                   (baz) #:select (qux foo)
                   (chbouib) #:renamer (symbol-prefix-proc 'p)))

What do you think?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-07-28 10:37 (define-module (foo) #:import (...)), a la r6rs Andy Wingo
  2011-07-28 21:23 ` Ludovic Courtès
@ 2011-07-28 21:40 ` Mike Gran
  2011-07-28 21:52 ` Jose A. Ortega Ruiz
  2 siblings, 0 replies; 11+ messages in thread
From: Mike Gran @ 2011-07-28 21:40 UTC (permalink / raw)
  To: guile-devel

From: Andy Wingo wingo@pobox.com

>
>Hi,
>
>I was hacking on Dorodango today, in a script that happened to have a
>Guile-style (define-module ...) block, and I was importing pieces of an
>rnrs library.  Then I needed to update the import set to provide what
>was needed.  In the middle of making a keyboard macro to add
>#:use-module before the library names, I realized that `library' is
>actually a lot better in this regard, in that you just have one `import'
>block, and all the libraries are listed there without having a prefix on
>each one.
>
>So what do you all think about:
>
>  (define-module (foo)
>    #:import ((bar)
>              (only (baz) qux foo)
>              ...))

We once discussed having a plural #use-modules in this thread.

http://lists.gnu.org/archive/html/guile-user/2007-10/msg00002.html

-Mike Gran




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-07-28 10:37 (define-module (foo) #:import (...)), a la r6rs Andy Wingo
  2011-07-28 21:23 ` Ludovic Courtès
  2011-07-28 21:40 ` Mike Gran
@ 2011-07-28 21:52 ` Jose A. Ortega Ruiz
  2 siblings, 0 replies; 11+ messages in thread
From: Jose A. Ortega Ruiz @ 2011-07-28 21:52 UTC (permalink / raw)
  To: guile-devel

On Thu, Jul 28 2011, Andy Wingo wrote:

> Hi,
>
> I was hacking on Dorodango today, in a script that happened to have a
> Guile-style (define-module ...) block, and I was importing pieces of an
> rnrs library.  Then I needed to update the import set to provide what
> was needed.  In the middle of making a keyboard macro to add
> #:use-module before the library names, I realized that `library' is
> actually a lot better in this regard, in that you just have one `import'
> block, and all the libraries are listed there without having a prefix on
> each one.
>
> So what do you all think about:
>
>   (define-module (foo)
>     #:import ((bar)
>               (only (baz) qux foo)
>               ...))
>
> Or even:
>
>   (define-module (foo)
>     (import (bar)
>             (only (baz) qux foo)
>             ...))

fwiw, i like the second form better (looks more schemish to me), and i agree
both forms are an improvement over #:use-module.

jao
-- 
I don't necessarily agree with everything I say.
 -Marshall McLuhan (1911-1980)




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-07-28 21:23 ` Ludovic Courtès
@ 2011-11-09 23:08   ` Andy Wingo
  2011-11-09 23:50     ` Ludovic Courtès
  2011-11-10 12:35     ` David Pirotte
  0 siblings, 2 replies; 11+ messages in thread
From: Andy Wingo @ 2011-11-09 23:08 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

Hi,

Procrastinating :)

On Thu 28 Jul 2011 23:23, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@pobox.com> skribis:
>
>> So what do you all think about:
>>
>>   (define-module (foo)
>>     #:import ((bar)
>>               (only (baz) qux foo)
>>               ...))
>>
>> Or even:
>>
>>   (define-module (foo)
>>     (import (bar)
>>             (only (baz) qux foo)
>>             ...))
>
> I’d prefer #:use-modules (plural), for consistency:
>
>   (define-module (foo)
>     #:use-modules ((bar)
>                    (baz) #:select (qux foo)
>                    (chbouib) #:renamer (symbol-prefix-proc 'p)))
>
> What do you think?

I don't like the paren placement so much.  Consistency is important, but
TBH I think that we should phase out the "use-module" / "use-modules"
terminology, in favor of "import" terminology of r6rs and the coming
r7rs.

What do you think about that? :-)

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-11-09 23:08   ` Andy Wingo
@ 2011-11-09 23:50     ` Ludovic Courtès
  2011-12-06 11:30       ` Andy Wingo
  2011-11-10 12:35     ` David Pirotte
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2011-11-09 23:50 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Hi!

Andy Wingo <wingo@pobox.com> skribis:

> On Thu 28 Jul 2011 23:23, ludo@gnu.org (Ludovic Courtès) writes:
>
>> Andy Wingo <wingo@pobox.com> skribis:
>>
>>> So what do you all think about:
>>>
>>>   (define-module (foo)
>>>     #:import ((bar)
>>>               (only (baz) qux foo)
>>>               ...))
>>>
>>> Or even:
>>>
>>>   (define-module (foo)
>>>     (import (bar)
>>>             (only (baz) qux foo)
>>>             ...))
>>
>> I’d prefer #:use-modules (plural), for consistency:
>>
>>   (define-module (foo)
>>     #:use-modules ((bar)
>>                    (baz) #:select (qux foo)
>>                    (chbouib) #:renamer (symbol-prefix-proc 'p)))
>>
>> What do you think?
>
> I don't like the paren placement so much.  Consistency is important, but
> TBH I think that we should phase out the "use-module" / "use-modules"
> terminology, in favor of "import" terminology of r6rs and the coming
> r7rs.
>
> What do you think about that? :-)

I find aesthetics important, but phasing out such an important construct
“just” for aesthetics seems harsh to me.

Besides, stuff like #:renamer is strictly more powerful than what
R[67]RS provide, IIRC.

Actually I’m happy with the ways things are currently, so I’m obviously
biased.  ;-)

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-11-09 23:08   ` Andy Wingo
  2011-11-09 23:50     ` Ludovic Courtès
@ 2011-11-10 12:35     ` David Pirotte
  1 sibling, 0 replies; 11+ messages in thread
From: David Pirotte @ 2011-11-10 12:35 UTC (permalink / raw)
  To: Andy Wingo; +Cc: Ludovic Courtès, guile-devel

Hi all,

> >> So what do you all think about:
> >>
> >>   (define-module (foo)
> >>     #:import ((bar)
> >>               (only (baz) qux foo)
> >>               ...))
> >>
> >> Or even:
> >>
> >>   (define-module (foo)
> >>     (import (bar)
> >>             (only (baz) qux foo)
> >>             ...))
> >
> > I’d prefer #:use-modules (plural), for consistency:
> >
> >   (define-module (foo)
> >     #:use-modules ((bar)
> >                    (baz) #:select (qux foo)
> >                    (chbouib) #:renamer (symbol-prefix-proc 'p)))
> >
> > What do you think?
> 
> I don't like the paren placement so much.  Consistency is important, but
> TBH I think that we should phase out the "use-module" / "use-modules"
> terminology, in favor of "import" terminology of r6rs and the coming
> r7rs.
> 
> What do you think about that? :-)
> 
> Andy

I 'feel' that a module uses another or several other modules. I feel that 'import'
is too close to some sort of 'cuisine interne', to my HO. Therefore I would prefer,
consistently with myself :), #:use-modules

What would be a must for me, and may be others ?, would be having a possibility
within 'define-module', to specify or globally or per used modules, that we also
wish to re export their public interface.

Cheers,
David




^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-11-09 23:50     ` Ludovic Courtès
@ 2011-12-06 11:30       ` Andy Wingo
  2012-01-07  0:23         ` Andy Wingo
  2012-01-08 16:28         ` Ludovic Courtès
  0 siblings, 2 replies; 11+ messages in thread
From: Andy Wingo @ 2011-12-06 11:30 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

Hello :)

On Thu 10 Nov 2011 00:50, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@pobox.com> skribis:
>
>> On Thu 28 Jul 2011 23:23, ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> Andy Wingo <wingo@pobox.com> skribis:
>>>
>>>>   (define-module (foo)
>>>>     #:import ((bar)
>>>>               (only (baz) qux foo)
>>>>               ...))
>>>>
>>>> Or even:
>>>>
>>>>   (define-module (foo)
>>>>     (import (bar)
>>>>             (only (baz) qux foo)
>>>>             ...))
>>>
>>> I’d prefer #:use-modules (plural), for consistency:
>>>
>>>   (define-module (foo)
>>>     #:use-modules ((bar)
>>>                    (baz) #:select (qux foo)
>>>                    (chbouib) #:renamer (symbol-prefix-proc 'p)))
>>
>> I don't like the paren placement so much.  Consistency is important, but
>> TBH I think that we should phase out the "use-module" / "use-modules"
>> terminology, in favor of "import" terminology of r6rs and the coming
>> r7rs.
>
> I find aesthetics important, but phasing out such an important construct
> “just” for aesthetics seems harsh to me.

Yeah, but it is not simply aesthetics: it is consistency with other
schemes, `import' is the natural converse of `export', and the important
cases of "import only these bindings", "rename these particular
bindings", and "import this module with a prefix" are really easy in the
r6rs import language.

> Besides, stuff like #:renamer is strictly more powerful than what
> R[67]RS provide, IIRC.

No argument there!  But I rarely use it.  Even #:select is a bit of a
PITA to use:

  #:use-module ((a) #:select (b c d))
  #:use-module ((e) #:renamer (symbol-prefix-proc 'p:))

vs

  (import (only (a) b c d)
          (prefix (e) p:))

In particular the #:use-module variant has non-obvious paren placement
for #:select two places: the wrapper for the whole form, and the list of
bindings.  And of course #:renamer would still be there for you to
use. if you wanted to.

Dunno, I still think this would be a good idea, but I think we would
need to come to agreement first.

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-12-06 11:30       ` Andy Wingo
@ 2012-01-07  0:23         ` Andy Wingo
  2012-01-08 16:28         ` Ludovic Courtès
  1 sibling, 0 replies; 11+ messages in thread
From: Andy Wingo @ 2012-01-07  0:23 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

Heya Ludo,

Ping :)  You still against changes to define-module?  I'm OK with that,
but I just wanted to get an explicit reaction.  Too much mail over the
last month, eh :-)

Andy

On Tue 06 Dec 2011 12:30, Andy Wingo <wingo@pobox.com> writes:

> On Thu 10 Nov 2011 00:50, ludo@gnu.org (Ludovic Courtès) writes:
>
>> Andy Wingo <wingo@pobox.com> skribis:
>>
>>> On Thu 28 Jul 2011 23:23, ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>>> Andy Wingo <wingo@pobox.com> skribis:
>>>>
>>>>>   (define-module (foo)
>>>>>     #:import ((bar)
>>>>>               (only (baz) qux foo)
>>>>>               ...))
>>>>>
>>>>> Or even:
>>>>>
>>>>>   (define-module (foo)
>>>>>     (import (bar)
>>>>>             (only (baz) qux foo)
>>>>>             ...))
>>>>
>>>> I’d prefer #:use-modules (plural), for consistency:
>>>>
>>>>   (define-module (foo)
>>>>     #:use-modules ((bar)
>>>>                    (baz) #:select (qux foo)
>>>>                    (chbouib) #:renamer (symbol-prefix-proc 'p)))
>>>
>>> I don't like the paren placement so much.  Consistency is important, but
>>> TBH I think that we should phase out the "use-module" / "use-modules"
>>> terminology, in favor of "import" terminology of r6rs and the coming
>>> r7rs.
>>
>> I find aesthetics important, but phasing out such an important construct
>> “just” for aesthetics seems harsh to me.
>
> Yeah, but it is not simply aesthetics: it is consistency with other
> schemes, `import' is the natural converse of `export', and the important
> cases of "import only these bindings", "rename these particular
> bindings", and "import this module with a prefix" are really easy in the
> r6rs import language.
>
>> Besides, stuff like #:renamer is strictly more powerful than what
>> R[67]RS provide, IIRC.
>
> No argument there!  But I rarely use it.  Even #:select is a bit of a
> PITA to use:
>
>   #:use-module ((a) #:select (b c d))
>   #:use-module ((e) #:renamer (symbol-prefix-proc 'p:))
>
> vs
>
>   (import (only (a) b c d)
>           (prefix (e) p:))
>
> In particular the #:use-module variant has non-obvious paren placement
> for #:select two places: the wrapper for the whole form, and the list of
> bindings.  And of course #:renamer would still be there for you to
> use. if you wanted to.
>
> Dunno, I still think this would be a good idea, but I think we would
> need to come to agreement first.
>
> Andy

-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2011-12-06 11:30       ` Andy Wingo
  2012-01-07  0:23         ` Andy Wingo
@ 2012-01-08 16:28         ` Ludovic Courtès
  2012-01-08 16:44           ` Andy Wingo
  1 sibling, 1 reply; 11+ messages in thread
From: Ludovic Courtès @ 2012-01-08 16:28 UTC (permalink / raw)
  To: Andy Wingo; +Cc: guile-devel

Hello!

Andy Wingo <wingo@pobox.com> skribis:

> No argument there!  But I rarely use it.  Even #:select is a bit of a
> PITA to use:
>
>   #:use-module ((a) #:select (b c d))
>   #:use-module ((e) #:renamer (symbol-prefix-proc 'p:))
>
> vs
>
>   (import (only (a) b c d)
>           (prefix (e) p:))

Sounds a bit like kill/yank vs. copy/paste.  ;-)

I’m happy with the current form and have a harder time parsing ‘import’,
but I can understand some may prefer ‘import’, in particular anyone who
comes to Guile with an R6RS background.

So if you think it's this worthwhile, go for it!

Thanks,
Ludo’.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: (define-module (foo) #:import (...)), a la r6rs
  2012-01-08 16:28         ` Ludovic Courtès
@ 2012-01-08 16:44           ` Andy Wingo
  0 siblings, 0 replies; 11+ messages in thread
From: Andy Wingo @ 2012-01-08 16:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel

On Sun 08 Jan 2012 17:28, ludo@gnu.org (Ludovic Courtès) writes:

> Andy Wingo <wingo@pobox.com> skribis:
>
>>   #:use-module ((a) #:select (b c d))
>>   #:use-module ((e) #:renamer (symbol-prefix-proc 'p:))
>>
>> vs
>>
>>   (import (only (a) b c d)
>>           (prefix (e) p:))
>
> Sounds a bit like kill/yank vs. copy/paste.  ;-)

Heh, indeed ;-)

> I’m happy with the current form and have a harder time parsing ‘import’,
> but I can understand some may prefer ‘import’, in particular anyone who
> comes to Guile with an R6RS background.
>
> So if you think it's this worthwhile, go for it!

OK, thanks for the feedback.  Next time I get bothered by this I'll
propose a concrete patch.

Cheers,

Andy
-- 
http://wingolog.org/



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-01-08 16:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-28 10:37 (define-module (foo) #:import (...)), a la r6rs Andy Wingo
2011-07-28 21:23 ` Ludovic Courtès
2011-11-09 23:08   ` Andy Wingo
2011-11-09 23:50     ` Ludovic Courtès
2011-12-06 11:30       ` Andy Wingo
2012-01-07  0:23         ` Andy Wingo
2012-01-08 16:28         ` Ludovic Courtès
2012-01-08 16:44           ` Andy Wingo
2011-11-10 12:35     ` David Pirotte
2011-07-28 21:40 ` Mike Gran
2011-07-28 21:52 ` Jose A. Ortega Ruiz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).