Extended Type Design.
Bill Baxter
dnewsgroup at billbaxter.com
Fri Mar 16 18:42:18 PDT 2007
Andrei Alexandrescu (See Website For Email) wrote:
> Bill Baxter wrote:
>> Andrei Alexandrescu (See Website For Email) wrote:
>>> sclytrack wrote:
>>>>> IMHO (b) should be 'readonly' and (c) should be 'const'.
>>>> [snip]
>>>>
>>>> vote++
>>>>
>>>>
>>>> Keywords
>>>> --------
>>>>
>>>> I also think keywords can be written attached to one another.
>>>> Like if you were to really call it "super const" have it called
>>>> superconst instead of super_const.
>>>
>>> Yet you write static const not staticconst; public static not
>>> publicstatic; static if and not staticif; and so on.
>>>
>>> superconst came up too. But it creates a bad precedent. A healthier
>>> precedent is to synthesize phrases, not new keywords, from the
>>> existing keywords. Think of "static if" or "final switch". Very
>>> beautiful.
>>>
>>>> It is like the foreach_reverse that we have in D. Why not
>>>> call it foreachreverse instead.
>>>
>>> Probably it's best to call it foreach reverse. It's unambiguous, easy
>>> to parse, does not add new keywords, and continues another nice
>>> precedent set by extern(language) and by scope(exit).
>>
>> So you mean foreach(reverse) then? I do like that! You're right that
>> it is quite D-like. Too bad you weren't around back when
>> foreach_reverse was introduced? ;-)
>
> Possibly even without the parens:
>
> foreach (i ; array) { ... }
>
> foreach reverse (i ; array) { ... }
>
> I have a feeling Walter is unlikely to change that though :o).
>
>
> Andrei
Except then 'reverse' would have to be a keyword too, no?
Or would you do away with parens in the extern and scope cases too? I
liked the suggestion because it makes foreach and its reverse variant
less of a special case. scope and extern can be followed by things that
that are keyword-like but that specify a specific variation of the
keyword. Likewise, foreach would be the same. But if you're going to
special case foreach in the end anyway, I see little point. It would
also open the door for some sort of foreach(parallel) construct without
having to introduce yet another underscored keyword with double-digit
character count.
--bb
More information about the Digitalmars-d
mailing list