Manifest constants - why not 'alias' ?
mandel
oh at no.es
Thu Dec 6 21:39:05 PST 2007
On Thu, 06 Dec 2007 21:07:18 -0800, Walter Bright wrote:
> David Gileadi wrote:
>> FWIW, alias makes the most sense to me out of the current crop of
>> suggestions. To me it says that wherever I see the alias, it will be
>> replaced with whatever value the alias is for. That seems to describe
>> manifest constants exactly.
>
> Since there's already:
>
> alias X Y;
>
> it would seem confusing to add:
>
> alias Y = X;
I know it was asked before for sure,
but could someone point out why not just use:
alias Y 42;
alias Z "abc";
alias X [1,2,3];
- it points out that it doesn't have a memory address (no '=' assigment)
- it will be filled in for X, Y, Z
btw.: enum for compile time constants doesn't fit it's
main meaning (enumeration), but it's secondary
meaning as compile time constants.
It's also limited (regarding to strings etc.).
I would call it a hack. :P
More information about the Digitalmars-d
mailing list