1. under_score
- Posted by Bernie <xotron at PCOM.NET>
Sep 16, 2000
-
Last edited Sep 17, 2000
--
How much trouble would it be to allow underscore characters
at the begining of a identifier, this would make interfacing
with "C" alot more readable and easier. There is no way to
define constants like :
constant __a_c_constant = #12345
when defining a "C" header for a library.
Sure you can change the name but then you are deviateing from
the library's documentation and you cause unneeded confusion for
the user of the Euphoria header.
Bernie
2. Re: under_score
----- Original Message -----
From: "Bernie" <xotron at PCOM.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Sunday, September 17, 2000 11:38 AM
Subject: under_score
> --
> How much trouble would it be to allow underscore characters
> at the begining of a identifier, this would make interfacing
> with "C" alot more readable and easier. There is no way to
> define constants like :
> constant __a_c_constant = #12345
> when defining a "C" header for a library.
> Sure you can change the name but then you are deviateing from
> the library's documentation and you cause unneeded confusion for
> the user of the Euphoria header.
>
> Bernie
I agree Bernie. This artificial restriction seems a little too picky.
Most language translators reserve "non-numeric identifier characters" as the
first character in an identifier to make it easier to distinguish numeric
literals from identifiers. The parser examines characters left-to-right, and
if at the beginning of a word, it hits a numeric character, assumes that a
numeic literal is coming, otherwise it tries to see if it's a valid
identifier name.
In Euphoria's case, the underscore is a valid non-numeric identifier
character, so it seems perfectly reasonable to allow it as a first
character.
[Mildly related off-topic follows....]
I also work with a language (www.progress.com) that has a dash '-' as an
allowable indentifier character, and so to make it easier for its parser,
the language syntax insists that math operators be surrounded by spaces, so
it can distinguish between a minus sign and a dash inside an indentifier
name. I think that this was a bad choice of identifier characters. Perhaps
they did this so you didn't have to press the Shift key to get the
underscore character.
----
cheers,
Derek