www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Keywords

'When I use a word,' Humpty Dumpty said, in rather a scornful tone, 'it means
just what I choose it to mean -- neither more nor less.' 

'The question is,' said Alice, 'whether you can make words mean so many
different things.' 

'The question is,' said Humpty Dumpty, 'which is to be master -- that's all.' 

I've been reviewing the list of the 100 or so keywords in the D "specification"
and have a few observations:

1. The list isn't kept up to date -- "pure" and "nothrow", e.g., are new
keywords that aren't in the list. I assume this is just a matter of priority
and will be corrected when more urgent things (e.g. transitive const) are

2. The vast majority of the keywords are unobjectionable. They are typically

a) terse ("auto", "float"), 

b) common English words, with a smattering of abbreviations ("char", "enum")
and compounds ("foreach", "mixin", "typeof"), and 

c) have well-established, technical meanings in C or other computer languages
("struct", "continue").

3. The ones we are struggling with ("const", "enum", ...) have a few common

a) They are associated with new featues in D. Unsurprisingly the majority of
these deal with the new const paradigm. I'm guessing the same thing will happen
with "pure" when the implementation is available for public comment.

b) They have multiple or overloaded syntactic usage (const types, const values,
const functions, const parameters). Overloading seems to be the main objection
to "enum" as the keyword for manifest constants.

c) Their technical meaning differs somewhat from their common usage. Look at
"static", for example. It has a well-defined technical meaning in Java and D,
but that meaning isn't the first one I think of when used in non-programming
conversation. (In fact, the first meaning that comes to mind for me is
"unchanging" -- i.e, "constant".) This is, I believe, an unavoidable difficulty
-- if the word meant exactly what we are used to, it wouldn't be a new idea.

This problem (c) is compounded with old keywords being used with a new
technical meaning (again, "const", "enum").

These observations lead me these (rather obvious) conclusions:

1) No new keyword is going to be universally, or even commonly, acceptable,

2) New uses for old keywords are especially troublesome, and,

3) There's no way to avoid this difficulty. 

We are used to programming languages that are created ex cathedra with our only
choice being to adopt it or not. We're not usually given a line-item veto. With
D we get to see and (attempt to) influence the development of the language.

Walter has chosen, I think wisely, to be resistant to modifications to keywords
and syntax once introduced. I'm often confused and sometimes disappointed by
this resistance, but I understand why it exists.
Apr 05 2008