How about 'pure' for constants?
Hxal
hxal at freenode.d.channel
Wed Dec 12 14:48:36 PST 2007
Gilles G. Wrote:
> "alias" does not express the intent of the definition.
> For example, when writing "alias foo = function int(int a, int b) {...};", the fact that the function does not have side effects is not explicit.
> The expressions
> pure real pi=3.14159;
> pure real A = area(real diameter);
> are much more informative.
You're right, this one doesn't. A pure pragma suits function definitions a lot better though. I realized after I wrote the first suggestion that you can even write "pragma(pure) int foo (...) {}".
As for using an alias declaration for constants, it's no less informative than a pure constant declaration, except it doesn't introduce a new keyword, nor does it reuse an existing one in a non-obvious way (enum).
More information about the Digitalmars-d
mailing list