unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: ludo@gnu.org (Ludovic Courtès)
Cc: guile-devel@gnu.org
Subject: Re: (define-module (foo) #:import (...)), a la r6rs
Date: Tue, 06 Dec 2011 12:30:31 +0100	[thread overview]
Message-ID: <87ty5endig.fsf@pobox.com> (raw)
In-Reply-To: <87pqh0zwi5.fsf@gnu.org> ("Ludovic Courtès"'s message of "Thu, 10 Nov 2011 00:50:10 +0100")

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/



  reply	other threads:[~2011-12-06 11:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ty5endig.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=guile-devel@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).