Re: [Scheme-reports] ANN: first draft of R7RS small language available Andrzej (05 May 2011 14:06 UTC)

Re: [Scheme-reports] ANN: first draft of R7RS small language available Andrzej 05 May 2011 14:05 UTC

On Thu, May 5, 2011 at 5:20 AM, Alaric Snell-Pym
<alaric@snell-pym.org.uk> wrote:
>
> Please can we now list the possible solutions, perhaps on a Wiki page,
> and for each one, work on a list of reasons why it sucks badly, with
> examples? Then we can try to find a decent solution...

To me it looks like we have two problems:
1) How to clean up the existing mess in 'cond' and 'case' forms (Are
other forms affected? How about 'quasiquote').
2) Provide a framework for hygienic user defined keywords.

Technically they are both same but in (1) we have to maintain backward
compatibility (we don't want to sacrifice all the existing code for
the sake of fixing relatively few corner cases, do we?) and we only
have to deal with a fixed number of well known keywords. In (2) we may
have more flexibility but we have to deal with an unbound number of
unknown keywords.

(2) can probably be fixed with quoted symbols but I don't have a proof
for it other than I couldn't come up with an example exposing any
problem with macro hygiene or with the module system.

To "fix" (1) I could only think of two solutions (except for using
quoted symbols which, I guess, are out of reach for compatibility
reasons):

a) Declare 'else', '=>' and other affected keywords as reserved words
and make it illegal to bind values to them. Errors could be signaled
early, at binding stage, instead of resulting in some obscure
behavior. That's a perfectly valid and effective solution (maintains
described semantics of 'cond' and hygiene of macros). Sure it is not
very elegant but we are only dealing with consequences of previous
mistakes.

b) Change the semantics of 'cond', 'case' and any other affected form
so that they use regular identifiers. This implies rewriting affected
sections of the specification. Because we are dealing with explicit
identifiers they should be specified as well. Andre has pointed out
that R7RS has already got a note endorsing this approach but I don't
think this is enough (R7RS first specifies undesired semantics and
then, in a loosely related section, it informs implementors and users
that the specified semantics is wrong. Why?)

Andrzej

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