kawa-commonlisp-dev
[Top][All Lists]
Advanced

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

Re: [Kawa-commonlisp-dev] Switching to Guile's #nil


From: John Cowan
Subject: Re: [Kawa-commonlisp-dev] Switching to Guile's #nil
Date: Sat, 22 Jun 2013 12:41:25 -0400
User-agent: Mutt/1.5.20 (2009-06-14)

Charles Turner scripsit:

> I don't understand why this is unspecified behaviour in the Scheme
> standards.

Well, in `(if p x)` you haven't specified what you want to get if p
is false, so the implementation picks something for you.  Note that
it is not unspecified behavior (Scheme can't die or throw an error);
it's specified to return an unspecified value.

In practice, therefore, the construction is used only when x is a
procedure call that is invoked solely for effect, and we might simply
have said that the return value of a one-armed conditional is unspecified
in all cases.  This was actually done in R7RS for `when` and `unless`.

It is a common idiom when implementing a procedure that returns
an unspecified value to end it with (if #f #f), which returns
whatever the implementation's notion of an unspecified value is; see
<http://trac.sacrideo.us/wg/wiki/OneArmedIf>.

-- 
At the end of the Metatarsal Age, the dinosaurs     John Cowan
abruptly vanished. The theory that a single         address@hidden
catastrophic event may have been responsible        http://www.ccil.org/~cowan
has been strengthened by the recent discovery of
a worldwide layer of whipped cream marking the
Creosote-Tutelary boundary.             --Science Made Stupid



reply via email to

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