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

Re: [Scheme-reports] Symbol escapes - clarification

On Mon, Jan 09, 2012 at 02:51:40PM -0500, John Cowan wrote:
> Peter Bex scripsit:
> > In "bare" symbols I'd expect anything but s-expression delimiters
> > (spaces, parens, semicolons and possibly single quotes, commas and
> > backticks) to be allowed but no "special interpretation" of composite
> > characters.  This keeps the reader simple; just consume characters
> > until you find an s-expression metacharacter.
> No Scheme in my list allows " within an identifier. 

Yeah, I wouldn't expect that either, just forgot about it.

> I haven't tested the other special lexical-syntax characters, but I
> expect all of them except # will be treated similarly.

Yeah, # is pretty special.  The spec should probably leave that
unspecified.  Maybe a whitelist of characters that are definitely allowed
in symbols?  Several (most?) schemes actually try to read until the next
s-expression separator and convert it to a number. If that fails, it's
a symbol and taken as-is.  I'm not sure this behaviour should be
standardized as it's very "loose" and poorly defined.

> > I think I've argued this point before, but it would be more consistent
> > to allow \ to escape the | so that || acts exactly analogously to ""
> > in strings, where backslashes escape the delimiter.
> > 
> > This is simpler, more regular and allows implementation to use the same
> > routine for reading strings and symbols (with the delimiter as parameter).
> Ticket #324 filed.


"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
							-- Donald Knuth

Scheme-reports mailing list