[Issue 1961] Allow "scoped const" contracts

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 1 08:30:51 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1961





------- Comment #6 from andrei at metalanguage.com  2008-04-01 10:30 -------
(In reply to comment #5)
> > And enum... you'll have to yank that out from my dead cold hands. Extending
> > enum instead of adding yet another way of defining symbolic constants is The
> > Right Thing to do. I am sure people would have realized how ridiculous the
> > whole "manifest" thing is if we first proposed it. We just can't define one
> > more way for each kind of snow there is.
> 
> While I agree completely with what you said about 'manifest' keyword, I quite
> don't agree about choosing 'enum' as word for manifest constant. IMHO there is
> much better keyword for this purpose: 'alias'.
> 
> Please notice that using 'alias' will be very consistent:

These are sensible points. Alias was a close contender. There is one issue with
it. Consider:

alias x = foo();

To the unwary, this looks like, hey, it's an alias - so whenever I write "x",
it will be automagically rewritten into "foo()". In reality CTFE will be done
against foo().

Before any other proposal comes forth: Enum does not have this problem and has
a learning curve that looks more like a flatline. Anonymous enums already have
99.9% of the needed properties, they only didn't accept other types than
integrals. Walter made them accept other types than integrals. It is good
language design, it solves the problem, and it removes an unjustified
limitation. Why the hubbub over this? 

We have so much bigger fish (whales!) to fry, it's frivolous to spend time on
this one shrimp. Let us move on, please.


-- 



More information about the Digitalmars-d-bugs mailing list