How about 'pure' for constants?
Janice Caron
caron800 at googlemail.com
Tue Dec 11 10:37:44 PST 2007
On 12/11/07, Frits van Bommel <fvbommel at remwovexcapss.nl> wrote:
> So opAdd & friends aren't CTFE'd? That seems like a silly omission, and
> should be easy enough to fix.
I figure "static" within struct declaration scope means "has no this
pointer". Only at global scope does it mean CTFE.
I guess "static" was a bad choice of keyword for CTFE!
My personal choice of keyword for CTFE would be /none at all/. Why
would you need one? Let the compiler decide! If the function is
/called/ at compile time, then that should be enough to declare it as
CTFE.
As for structs and pure, I think it works. If a struct can be used in
a pure function, and contains only pure functions, then "pure" still
seems a better word than "enum". And if it's /not/ pure, then just use
const like we have up till now, and live with the storage cost!
More information about the Digitalmars-d
mailing list