Extended Type Design.
Benji Smith
dlanguage at benjismith.net
Fri Mar 16 09:55:15 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> We've shoved keywords like "readonly" and "view" for a while, and they
> just added more confusion than cleared, at a high cost. If (as I
> suspect) super const appears relatively infrequently, it might be fine
> to just encode it as the mildly verbose "super const". In fact, it's
> shorter than "keepyourgrubbyhandsoff". :o)
>
> Andrei
Really? I'd think super const would be used all the time. Anywhere a
class has some invariant field, it'll probably be expressed as super
const (if I'm understanding correctly that super const is the equivalent
of #define constants in C++ or static final constants in Java).
Let me join the ranks of those who hate both versions of the new syntax.
const! looks either like a template or like "not const". You guys may
think you're saving a keyword, and that might be technically correct
from the perspective of the parser. But, for the perspective of the D
developer, it still looks like you've introduced a new keyword, but it's
a keyword that's A) nearly identical to another keyword, and B) contains
a symbol. Ugh. I really. Really. Really. Hate it.
Using "super const" is also annoying because all of the other storage
classes use a single keyword. Now we've got this weird case that uses
two keywords. And the word "super" is now overloaded in two completely
unrelated concepts.
(By the way, I don't like "static if" either. I think the right choice
would have been #if, #foreach, etc. And I think C++ made a mistake by
defining "long long" and "double double" types as well. Presumably, that
saved some keywords, but we'd all have been better off if the types were
defined as int8, int16, int32, int64, float32, float64, etc).
I vote for "readonly" and "const". Anything else seems like a mistake.
--benji
More information about the Digitalmars-d
mailing list