[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (define-module (foo) #:import (...)), a la r6rs

From: Andy Wingo
Subject: Re: (define-module (foo) #:import (...)), a la r6rs
Date: Tue, 06 Dec 2011 12:30:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Hello :)

On Thu 10 Nov 2011 00:50, address@hidden (Ludovic Courtès) writes:

> Andy Wingo <address@hidden> skribis:
>> On Thu 28 Jul 2011 23:23, address@hidden (Ludovic Courtès) writes:
>>> Andy Wingo <address@hidden> 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:))


  (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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]