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

Re: here strings and symbols



Sebastian Egner <sebastian.egner@xxxxxxxxxxx> writes:

>> I'm having trouble imaging a use for "here symbols". Did you have
>> something in particular in mind?
>
> Well, writing symbols from different languages. I understand that
> the additional lexical syntax for symbols is intended to include
> all sorts of things, e.g. whitespace, without using string->symbol.
> Now if I generate external representations of symbols from other
> programming languages and write them into a file, I still need
> some sort of quoting mechanism to produce the proper '|'-form.

Yes, and you do.  That still doesn't give a rationale for "here
symbols."

> There are of course tons of ways to interpret this, but for
> me symbols and strings are completely identical, except that
> symbols are internalized and have fewer operations defined on them.
> With this idea of symbols and strings, it is natural to see them
> be treated in the same way. Unfortunately, quote (') has a certain
> meaning already, otherwise I would to make '<string literal> a symbol.

One way to view the rationale is simply to extend read/write
invariance to all symbols, not just those that correspond to quoted
literals.  In this view, the correspondence between symbols and
strings is tangential and secondary.

If you're naming things from other languages, it's hard to see why you
should be using symbols instead of strings, unless there is a natural
correspondence between the unquoted symbol syntax and the foreign
syntax (as there is, sometimes)---pretty much the same amount of
typing is involved in either case, and (depending on the underlying
representation, which may be different from strings and symbols---as
it is in PLT Scheme, for example) the string representation will give
you more efficient access.

Which summarizes why I dislike this whole |...| business, which
mentally takes us back to the Lisp of the 60s---it makes people use
symbols for things they shouldn't use them for.  It also clutters the
syntax with more unnecessary baggage in a language which is supposed
to be minimal and exceptionally clear.

This in turn identifies another solution to the read/write invariance
problem, namely that of restricting the domain of STRING->SYMBOL to
that of <symbol> in the lexical syntax.

-- 
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla