[r6rs-discuss] [Formal] Rename on export considered harmful

Carl Eastlund cce at ccs.neu.edu
Mon Jan 22 13:30:05 EST 2007


On 1/20/07, John Cowan <cowan at ccil.org> wrote:
>
> Report section 6.1 provides a facility for renaming identifiers on export
> from a library, but no explanation is given for it.  The need to rename
> identifiers on import is plain, as they may need to change to avoid
> conflicts with other imported or local identifiers.  At export time,
> however, such conflicts are not known.
>
> Having two different "native" identifiers in a library is overkill.  It is
> the very simplest of refactorings to globally change all the instances
> of identifiers in a given module, and that ought to be sufficient.
> Either remove the facility or give a strong justification for it, please.

First, I do not see that the R6RS standard should enforce a particular
naming convention on programmers.  If a programmer needs to import and
export the same name (but not with the same value), currently they
have choices.  They can import NAME as original-NAME, then define NAME
and export it as NAME.  Or they can import NAME as NAME, then define
modified-NAME and export it as NAME.  For clarity, they could even
import NAME as original-NAME, then define modified-NAME and export it
as NAME.  I see no reason to force all programmers to use the first
convention.

Second, renaming on export allows programmers to export a single value
with two different names.  Programmers could work around this by
writing (define NAME2 NAME1), but again I see no reason this should be
necessary.

-- 
Carl Eastlund



More information about the r6rs-discuss mailing list