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

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



On Wed, Apr 20, 2011 at 12:45 AM, Andre van Tonder <andre@x> wrote:
> On Tue, 19 Apr 2011, Alex Shinn wrote:
>
>> We're getting lost in the details on the individual points, and
>> they pretty much all hinge on the one real question - are
>> imported values required to be the "same" binding in terms of
>> the syntax-rules pattern language?
>
> No, this has nothing to do with the question of keywords.  In Chez and
> Larceny, they are the same binding.  In the PLT system they were not - new
> bindings were created upon import in many cases (i.e., the module was
> reinstantiated more than one time), yet both systems were able to bind,
> import, and export keywords as I advocated.

Wel, you've just changed my question - it is not whether
new bindings are created or not at the implementation
level, but whether as I said they are the same

  [...] in terms of the syntax-rules pattern language?

Since R5RS doesn't have imported bindings, this
question is at least worth asking.

You did give many reasons why keywords should be
bound, but they seemed to take this as a given,
rather than provide support it.

I think now you're saying that you tried it and it
just didn't work, which is more useful information,
but not proof.

>> (1)
>> [...]
>>  Con: Keywords aren't guaranteed to actually match outside of
>>  the (scheme) module.
>
> This con is incorrect.  It can be a con if you DON'T bind the keywords in
> some systems, not if if you DO bind them.  If you bind them, they MUST match
> if your macro system is correctly implemented.  This is a simple question of
> lexical scoping, which is fundamental in Scheme.

The whole presupposition of the (1) section is specifically
that we don't require the matching.  As you corrected later,
this hypothetical situation doesn't break lexical scope.

The Chibi algorithm is a little unusual, and I may need to
change it depending on what we do with the standard, but
I happen to like it a lot.  Whereas in Chez all identifiers are
effectively bound in the top-level (whether they really are or
not), in Chibi all identifiers are effectively _unbound_ at the
top-level.  This means you can import multiple macros using
the same keywords and not have to rename them, whether
the keywords are bound or not - it just works.

The option of _not_ renaming I consider to be far more
important than the ability to rename.  I had honestly never
considered that you might want to rename deliberately, and
I see now that might have uses, but it seems the most
common use will be to avoid conflicts from macros using
the same keywords.  There are many macros out there
using common keywords like ":" and "<=", and it's a real
pain not to be able to use them together without renaming
one.  You have to keep in mind all the renamings as you
look at the code, and can't cut&paste examples.

And then there are the special keywords: quote, unquote,
etc.  If you rename these you can't use the reader shortcuts,
so when you mix macros that rely on them the syntax
because a lot more clumsy than usual.

This is a very broken state of affairs, and we need to
explore better ways of handling it.  For example, it might
be worth allowing import "merging" of keywords, so the same
keyword can work with multiple macros, but having the binding
of only one or zero of the macros.

Pending a better way to deal with keywords, I want to
leave the standard as open as possible.

Note the ability to rename and the option to not rename are
not mutually incompatible.  Chicken works similar to Chibi
except that it allows renaming (even if the identifiers aren't
bound).  I think this may be the best of all worlds.

-- 
Alex

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