DMD 0.163 release
James Dunne
james.jdunne at gmail.com
Thu Jul 20 17:59:31 PDT 2006
Walter Bright wrote:
> James Dunne wrote:
>
>> What's so bad about context dependent keywords?
>
>
> Then the lexer cannot tokenize the source without doing a parse. This
> negatively impacts tools that need to do so like Ddoc.
>
Sure it can. Treat 'as' as an identifier everywhere. It only has
special meaning within the 'alias' statement syntax. During parsing you
treat it as an identifier and check that it equates to the string 'as'.
What does Ddoc need to know about keywords for? It's a function of the
DMD compiler and should thus know everything DMD knows. 'as' is not a
keyword, anyway. A tool designed to work with the language should
implement a correct lexer and parser combination.
> Furthermore, it is confusing if one also has a typedef named 'as'.
> Having keywords be distinct, and always distinct, from identifiers means
> you can look at code and see what's an identifier and what's a keyword
> without confusion.
Perfectly legal:
alias int as as;
int main(char[][] args) {
as b;
b = 2;
}
'as' means nothing to the compiler outside the 'alias' statement. It
goes back to the same argument as "IF THEN THEN ELSE ELSE END"
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/MU/S d-pu s:+ a-->? C++++$ UL+++ P--- L+++ !E W-- N++ o? K? w--- O
M--@ V? PS PE Y+ PGP- t+ 5 X+ !R tv-->!tv b- DI++(+) D++ G e++>e
h>--->++ r+++ y+++
------END GEEK CODE BLOCK------
James Dunne
More information about the Digitalmars-d-announce
mailing list