How about 'pure' for constants?

Janice Caron caron800 at googlemail.com
Tue Dec 11 14:05:49 PST 2007


On 12/11/07, Robert Fraser <fraserofthenight at gmail.com> wrote:
> Hmmm... It's not a bad idea, but (like with enum & final), this worries me:
>
> pure
> {
>      int x = 5;      // Manifest Constant
>      void func() { } // Function without side effects
> }

That's not really worrying at all. Think of it like this

    pure int x() = 5;

A function without side-effects. And since you can't take the address,
what's the difference?



More information about the Digitalmars-d mailing list