PhobosWatch: manifest => enum

Walter Bright newshound1 at digitalmars.com
Sat Dec 29 18:03:57 PST 2007


John Reimer wrote:
> The manifest constant is really quite different from the other semantics 
> of constant;

The previous problems we were having with the design of the const system 
all seemed to revolve, one way or another, around trying to accommodate 
two different kinds of constants with one scheme. Separating the two, 
i.e. the notion of "manifest constant" from "constant type", seems to 
finally allow things to work.

> and I think that it deserves to be set apart from the rest 
> as a completely different entity (afterall this used to be achieved by 
> something like #define's in C/C++).

Yes.

> But then, I'm not sure if you have 
> set goals on how many keywords you're allowed to add per year.  If you 
> have some sort of limit, I can see how you necessarily must show 
> restraint. :)

As I remarked elsewhere, there is no language design problem that cannot 
be resolved by adding more keywords. Just like with aircraft design, 
there is no problem that cannot be fixed by adding more thrust <g>.

D already has quite a lot of keywords. Trying to stem the flood if 
possible is a reasonable goal.

> My question is: at what point do D keywords reach critical mass (in terms 
> of keyword hijacking for new functionality)?  This seems to happen 
> repeatedly as D struggles to avoid keyword additions... at what /appears/ 
> to be the expense of the programmer.

As I suggested, all the enum enhancements do is remove restrictions 
placed on its use. I don't see how that is costing the programmer.

> This new manifest enum could work and eventually people might just get 
> used to it... but it's so strange, so foreign, and so seemingly 
> inconsistant that I think your betting heavily on the good-graces of your 
> d community (who likely will forgive you and move on).

I think it'll seem strange for about 5 minutes, and then will seem 
normal. After all, that's what happened with the !( ) syntax for 
templates rather than < >.

> But I do wonder if 
> this is the case for all those users that are still deciding whether to 
> adopt D or not.  D 2.0 is an indicator of what is to come... so decisions 
> made here are going to speak volumes about the future.
> 
> I don't know how newcomers would react or what confusion it would cause 
> novices, so I won't use that as argument against it.  But it's a gamble 
> and a seemingly very risky gamble.  Some would say high-risk gambles 
> don't make sense, especially when the payback is nominal. 

I would argue it is less confusing than introducing yet another keyword, 
especially a keyword whose usage overlaps 3 other keywords, but only 
time will tell.



More information about the Digitalmars-d mailing list