John Cowan <[email protected]> writes:
> On Tue, Aug 28, 2018 at 3:01 AM Mark H Weaver <[email protected]> wrote:
>
> In RnRS, (define a (if #f #f)) is allowed and guaranteed to assign
> *some* object to 'a' without signalling an error.
>
> Actually, the phrase used is "the result is unspecified", which unfortunately
> is not defined in any RnRS.
That's the phrase used in R7RS-small, which fails to define it, as you
noted, but that shortcoming is limited to R7RS.
In R6RS, section 11.4.3 (Conditionals) provides this example:
(if #f #f) ===> unspecified
whose meaning is defined in section 6.6 (Evaluation examples), which
states:
Moreover, the "===>" symbol is also used to explicitly say that the
value of an expression is unspecified. For example:
(eqv? "" "") ===> unspecified
I take the use of the singular form of "value" here to imply that it
returns only one value.
R5RS is even more clear. It states "If <test> yields a false value and
no <alternate> is specified, then the result of the expression is
unspecified."
Section 1.3.2 of R5RS makes it crystal clear what that means:
If the value of an expression is said to be "unspecified," then the
expression must evaluate to some object without signalling an error,
but the value depends on the implementation; this report explicitly
does not say what value should be returned.
> Racket produces a syntax error in this situation at least in its
> default language.
Racket has diverged from Scheme quite a bit, to the point that they
don't even call the language "Scheme" anymore, but rather "Racket".
Mark