Static overused? (was Re: Inner classes - More expressiveness needed)

Henning Hasemann hhasemann at web.de
Thu Oct 25 10:30:43 PDT 2007


> Even if you count "static assert" as a conditional, there's still
> "static import", which is already three completely distinct uses for
> one keyword. The only other keyword with that many is "in". (One of
> which you might not even count, as it's obvious to anybody without
> programming experience what "a in b" means. With "static", none of
> the meanings are as obvious.)
> 
> As far as I can come up with, "out", "scope", and "void" have two
> distinct meanings, and the rest have one.

'import' has 2:  'import foo', 'import("foo")'
'mixin' has at least 2:  'mixin Foo!()', 'mixin("foo")'
'this' has at least 2: 'this() { }', 'this.foo'
'alias' has at least 2: 'alias myint int;', 'tempalte Templ(alias T){}'

I'd guess one could find more examples (const in D2?).
I dislike this too. I dont think its such a big problem to have more
keywords, especially when they denote different features.
But it seems to me Walter & co are more concerned about polluting the
code namespace then by this problem.

(Which has it good sides too when it comes to backwards compatibility,
but I feel it should be more important to choose expressive keywords
then retaining backwards compatibility especially in the 2.x branch I
think it would be a good idea to reconsider keyword choices as
backwards compatibility is not an issue there.)

Henning

-- 
GPG Public Key:
http://gpg-keyserver.de/pks/lookup?op=get&search=0xDDD6D36D41911851



More information about the Digitalmars-d mailing list