[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: here strings and symbols
> At Tue, 12 Jul 2005 12:03:28 +0200, Sebastian
> > It struck me that the new lexical syntax for symbols is also
just a 'here
> > string',
> > albeit with the fixed key "|".
> I don't understand. I think the new lexical syntax for quoted symbols
> is that of a normal quoted string, but with the start and end character
> as | instead of ". It's not at all like a here string, because
> in the quote symbol work the same as in a quoted string.
You are right, there is a fixed delimiter ('|') just
in the string case ('"'); what I mean is the
The purpose of an escape mechanism is to enable the
of more symbols into the string than are available
in the alphabet.
However, it implies that you have to escape the escape
themselves and also the delimiter characters. Now,
this means the escape mechanism differs by type; so
if you write
a string you need to escape '"' and if you write
a symbol you
need to escape '|' but not '"':
double-quote characters that are part of
the symbol need
not be escaped, whereas vertical-bar characters
in the symbol
must be escaped.
This sort of definition is logical but also more complicated
necessary, which is no problem until the day you have
manipulating the names of strings and symbols and
them in different formats. If there would only be
for escaping this would become simpler.
> > Wouldn't it make more sense to have two
forms of 'here string,' one
> > within a line and one spanning several lines, and then having
> > modifier indicating string or symbol?
> I'm having trouble imaging a use for "here symbols". Did
> something in particular in mind?
Well, writing symbols from different languages. I
the additional lexical syntax for symbols is intended
all sorts of things, e.g. whitespace, without using
Now if I generate external representations of symbols
programming languages and write them into a file,
I still need
some sort of quoting mechanism to produce the proper
There are of course tons of ways to interpret this,
me symbols and strings are completely identical, except
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.