Seems like everybody's proposing const ... so here's another one

Denton Cockburn diboss at hotmail.com
Fri Dec 7 08:30:15 PST 2007


On Fri, 07 Dec 2007 17:10:52 +0100, Mike wrote:

> Why not keep the simple things simple?
> 
> const int simple_pi = 3;
> 
> Const, final and invariant have "default" meanings, whatever Walter
> thinks makes the most sense. If you have the need to be specific about
> constness, you use:
> 
> const(head: mutable, tail: invariant) [...];
> 
> It is aliasable of course.
> 
> alias const(head: random, tail: pay-per-view) my_silly_const; // (*)
> my_silly_const [...];
> 
> What do you think?
> 
> -Mike
> 
> (*) Disclaimer: I don't mean to be sarcastic, it's just a silly joke
> because it's friday :)

Maybe it could be implemented in some esoteric template code.

That's the idea that Walter mentioned from Andrei (not yours, but 
tailconst!(c)).
That's the best solution right now, but yours can certainly be 
implemented in another template.



More information about the Digitalmars-d mailing list