Extended Type Design.
Bill Baxter
dnewsgroup at billbaxter.com
Fri Mar 16 17:10:26 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Deewiant wrote:
>> Benji Smith wrote:
>>> And the word "super" is now overloaded in two completely unrelated
>>> concepts.
>>>
>>
>> Which isn't that rare, see the following link:
>> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageSpecification/KeywordIndex
>>
>> I find the following examples: auto, in, is, mixin, scope, static.
>>
>> I have come to abhor the keyword "static" largely due to the above.
>> Too bad its
>> various uses are unavoidably useful. <g>
>>
>> But I do agree with you, in a way. After writing the following I find my
>> explanation somewhat unclear even to myself, but bear with me.
>>
>> The problem with "super const" is that "super" modifies the other
>> keyword,
>> "const", instead of saying something about the
>> expression/statement/whatever (in
>> this case, the type). Even "static", in all its horror, can be seen as
>> specifying one of "module-level" or "compile-time". The other keywords
>> mentioned
>> above use their English meaning as such an explanation, and so can be
>> understood
>> without too much thought. "super const" would make "super" another
>> "static":
>> lacking context, you can't be sure about about even the general
>> meaning, let
>> alone the one in a specific instance.
>>
>> Upon reflection it may be moot, since one probably rarely cares about
>> keywords'
>> meanings without context, but I'm sure some psychologist could come up
>> with
>> something about intuitiveness which affects coding speed, or whatever.
>
> Working in NLP myself, I totally disagree. Natural language is rife with
> homonimy and synonimy, and we're all very, very happy with that. But in
> this case we don't even have to go that far: "super" is an adjective
> meaning primarily "of high grade or quality" and qualifies a noun. If
> there's no noun, you don't know what is "of high grade or quality". It's
> a fact, and we don't even blink.
>
> The reality behind super const is that it expresses a stronger form of
> const. It makes a lot of sense if I dub it "super const" in natural
> language, to express it in the same way in the programming language. I
> thought that that's too verbose and devised "const!" as a shortcut
> (again with obvious conotations in natural language), but I'm thinking
> of dropping it and let type inference add "super" to "const" whenever it
> can. That should ensure exactness of the type system without verbosity
> in source code.
>
>> I'd be happiest to just get the feature as soon as possible; worrying
>> about
>> keyword semantics can come later. Just like the abominations beginning
>> with
>> "on_scope_". <g>
>
> Great idea. :o)
>
>
> Andrei
If you just want something that sounds like more const than const using
existing keywords, there are other options:
'true const'
'double const'
'finally const'
'is const'
or
'is finally super double true const'
I kinda like 'true const' myself. Sounds less dorky than super const to me.
:-)
--bb
More information about the Digitalmars-d
mailing list