Subject: Re: Scheme evaluators for Windows
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 25 Jan 2001 10:10:36 GMT
Newsgroups: comp.lang.scheme
Message-ID: <94ou2s$2ms8u$1@fido.engr.sgi.com>
Boris Smilga  <boris@bhasha.com> wrote:
+---------------
| rpw3@rigden.engr.sgi.com (Rob Warnock) writes:
| > Eamon Millman <mattimeo@waimea.hawaiian.net> wrote:
| > | I attemped to load the 'subst.scm' goodie into Dr. Scheme...
| > | (-1+ n)))))) with "Reference to undefined identifier: -1+"
| > 
| > Sounds like you're missing some prerequisite library file, that your
| > instructor probably put together, that contains a bunch of non-standard
| > extensions such as "-1+"...
| 
| Let alone the fact that -1+ is not an identifier under R5RS (2.1, page 5).
| P.S. Inner voice says: Smilga, shut goddamn up and stop annoying
| people with your hang-about for standards! Nay, really.
+---------------

Actually, R5RS section 2.1 does not disallow it from being accepted;
that section only talks about what *must* be accepted. The formal lexical
syntax is given in 7.1.1, and while the lexical grammar given there
doesn't accept "-1+", neither does it say what to do if a token is not
accepted. In particular, it does *not* forbid non-accepted tokens from
being treated as identifiers -- it is simply silent on the whole issue.
Likewise, section 6.6.2 fails to say anything about parsing errors in
"read" [except in the case where EOF occurs after an object is started
and before it's completed]. However, section 2.1 does say:

	The precise rules for forming identifiers vary among
	implementations of Scheme...

And 1.3.1 says:

	Implementations are free to omit optional features of Scheme or
	to add extensions, provided the extensions are not in conflict
	with the language reported here.

Since it isn't forbidden to do so, MzScheme takes the "be liberal in
what you accept" approach:

	<URL:http://www.cs.rice.edu/CS/PLT/packages/doc/mzscheme/node151.htm>
	...
	MzScheme's identifier and symbol syntax is considerably more
	liberal than the syntax specified by R5RS. When input is scanned
	for tokens, the following characters delimit an identifier...

and goes on to discuss a handful of other special cases, then:

	An input token constructed in this way is an identifier when it
	is not a numerical constant (following the extended number syntax
	described in section 4.3). A token containing a backslash or
	vertical bars is never treated as a numerical constant.

But the real question is not MzScheme's (or any number of other
implementations') acceptance of it, but the professor's class "goodies"
using it. At the very minimum, the students should be taught that such
forms are extensions of the standard language and possibly non-portable.


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
SGI Network Engineering		http://reality.sgi.com/rpw3/
1600 Amphitheatre Pkwy.		Phone: 650-933-1673
Mountain View, CA  94043	PP-ASEL-IA