chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] [PATCH] Add unexport form for modules


From: Peter Bex
Subject: Re: [Chicken-hackers] [PATCH] Add unexport form for modules
Date: Wed, 7 Jun 2017 22:11:39 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Wed, Jun 07, 2017 at 03:54:43PM -0400, John Cowan wrote:
> On Wed, Jun 7, 2017 at 2:06 PM, <address@hidden> wrote:
> 
> Isn't it easy to forget particular identifiers that happen to start with
> > "fp"
> > as well? I think explicit "rename" imports are clearer and less error
> > prone.
> >
> 
> My example is bad: you'd want to use it with a module where all the names
> begin with the same prefix, or almost all.  Another application is to drop
> the author's prefix and then add your own:  (import (prefix (drop-prefix
> srfi-13 string-) s:)) would change all the SRFI 13 identifiers beginning
> "string-" to begin "s:" instead (you'd want to change the Scheme
> identifiers too).
> 
> An open question is what to do when an identifier is the same as the
> prefix:  Chibi imports it unchanged, Chez changes it to || (the empty
> identifier).  A third possibility is to not import it.

What happens if you have an export list that includes both a prefixed
identifier and the same unprefixed identifier?  So you have (foo my-foo)
as an export list and you import it elsewhere as
(import (drop-prefix mymodule my-)).

To me this seems to introduce a nasty ambiguity.  You could warn, but
that's ugly and somewhat dangerous, if a new version of the module
suddenly contains such an ambiguity: you never know how a user is
going to rename.  Perhaps a saner approach is to only ever import
identifiers that actually have the prefix.


Cheers,
Peter

Attachment: signature.asc
Description: Digital signature


reply via email to

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