[Top][All Lists]

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

Re: [Chicken-users] unary 'when' and 'unless'

From: John Cowan
Subject: Re: [Chicken-users] unary 'when' and 'unless'
Date: Fri, 6 Nov 2015 06:27:45 -0500
User-agent: Mutt/1.5.20 (2009-06-14)

Sven Hartrumpf scripsit:

> A hidden bug in my code was uncovered by loading it into another
> Scheme (guile), which enforced the limitation of 'when' and 'unless'
> (in R7RS) to at least one result part.

That's pretty much normal in the R5RS/R7RS regime.  I had a similar
problem when I wrote a program in Chez, which at that time and for
historical reasons accepted () as equivalent to '(), as in Common Lisp.
When I moved the code to another Scheme, it broke, and of course mere
search and replace wouldn't fix it, as (lambda () ...) couldn't become
(lambda '() ...).

> Chicken accepts 'when' and 'unless' with only one argument:

In my view, this is a very reasonable extension to R7RS (which in any case
did not exist when `when` and `unless` were added to Chicken; they too
ultimately come from CL).  If the R7RS WG had reflected more on the use of
`when` and `unless` by macros, we might have specified them that way.

> I assume that the extended definition in Chicken is R7RS-compliant,
> but a stricter mode (or a harsh warning) would be helpful.

This is arguably the domain of a separate program (`r7rs-lint`, perhaps)
whose job it is to provide good portability warnings.  One of the reasons
for the failure of the R6RS to take over the Scheme world was its thorough
attempt to mandate portability using a great many statements containing
"must", what Will Clinger calls "preposterous mustard".  This left it
deeply incompatible with existing implementations that did not already
have multiple language modes (like Racket).

Such a program doesn't exist and can't exist in full generality, but
someone who needed it and was interested could make a good first effort
that would look for malformed standard syntax, too many or too few
or manifestly wrong-typed arguments to standard procedures, and so on.

John Cowan        address@hidden
Any day you [see] all five woodpeckers is a good day.  --Elliotte Rusty Harold

reply via email to

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