This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Serious eq? bug?


> guile> (eq? (string->symbol "-i") '-i)
> #f
> Is this expected behavior for an R4RS scheme which supports complex
> number?

Yes.  Not only expected, but required.

The Subject line is of course misleading.  There is nothing the
matter with eq?.  The issue is the Scheme reader - how should '-i
be interpreted?  It is clear from R4RS that -i is a number,
and hence cannot be eq? to any symbol.

> If so, it's a real pain in the ass for command line
> processing...

How so?  Why would you use symbols for command line arguments?
That seems completely inappropriate:
- Symbol are case-insensitive (in standard Scheme, at least).
- Many characters cannot be part of symbols, unless you quote
them (which is non-standard), or use string->symbol.
- Symbols are atomic, and so you cannot process individual characters
(without using symbol->string).
- Scheme uses strings for filenames, not symbols.
- Symbols are interned, whihc is probably not appropriate to
transient commmand-line arguments.

A command-line argument-list is a sequence (list or vector) of
strings, not symbols.

If you want to be able to write '-i instead of "-i", well, I'm sorry,
that is not Scheme.  If you want a nice terse shell syntax for
interactive commands, while still maintaining the power and semantics
of Scheme, that is a reasonable goal, which I am happy to discuss.
However, don't use the Scheme reader for that.

For some of my ideas for a functional shell, see:
	http://www.cygnus.com/~bothner/Qshell.html

	--Per Bothner
Cygnus Solutions     bothner@cygnus.com     http://www.cygnus.com/~bothner