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

Re: [Scheme-reports] ANN: first draft of R7RS small language available



On Sun, Apr 17, 2011 at 2:09 AM, Andre van Tonder <andre@x> wrote:
>
> This discussion has been had in R6RS and based on the discussion there the
> decision was made to make it and other literals bound in the base.  There
> were many reasons for it, among others:

Thanks, Andre, I had read through the R6RS discussions
but somehow forgotten this one when the issue came up
in WG1.

> - There is a very strong argument for requiring these literals to be bound.
> If they refer to bindings, they can be exported, imported, prefixed, renamed,
> or excluded. These are useful operations, and I think it is important for
> users to be able to rely on them to work portably.

This and most of your arguments confused me
greatly for a while, because a different identifier
should never match a syntax-rules literal.

Then I realized you're assuming that any imported
binding from another module should count as having
the "same lexical binding," not simply be bound to
the same value, in which case they would match.

The module system does not make this requirement,
in deference to the many types of module systems
out there which may simply copy the bindings, so in
general you can't assume you can rename =>.

I'll add a ticket raising the question of whether we
make this requirement.

> - We cannot easily create a teaching language where => clauses are not
> allowed in COND unless => is bound.

Sure you can, just bind =>.

> - The semantics of FREE-IDENTIFIER=? which is used to compare literals -
> unbound identitifiers in different modules be free-identifier=? if they have
> the same symbol?  This is not obvious to me, and as an implemento I know
> from experience that it can complicate a macro explansion system to insist
> upon it

There is no free-identifier=? in WG1 Scheme, nor at the present
time is there likely to be in WG2 Scheme.  The syntax-rules
semantics makes it clear that unbound symbols in two modules
must match, even if the implementation has a broken free-identifier=?.

> - Typically, such literals mcan be bound to a macro expanding to a syntax
> error, which is extremely useful for error checking.

If they are unbound we also get a descriptive error.

> - A lot of these literals are common enough names that users are likely to
>  stop on them by accident.  Fi they are bound, the expander will thorw an
>  redefinition error.

Not if they are locally shadowed, and some module systems
allow redefinition of imports.  The WG1 module system doesn't
explicitly forbid this, though I'll add a new ticket for it.

-- 
Alex

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports