digitalmars.D.learn - enum functions
- Paul D Anderson (21/21) Jun 20 2014 Does enum have any effect on functions?
- Andrej Mitrovic via Digitalmars-d-learn (3/4) Jun 21 2014 I think that's just a parser bug.
Does enum have any effect on functions? Is this: mixin (Constant!("ln2")); package enum T ln2(T)(Context context) { return log(T.TWO, context, false); } different from this: mixin (Constant!("ln2")); package /*enum*/ T ln2(T)(Context context) { return log(T.TWO, context, false); } The spec says that enums are used to declare constants. I'm not sure what it means for a function to be constant. My guess would be that the value of the function is CTFE'd and that value is stored as if it were a manifest constant, but that's not what happens. The enum functions operate exactly like the non-enum functions. So either enum functions are different in some way or they're not. If they are different that should be in the spec. If not, enum before a function declaration should not be allowed. Paul
Jun 20 2014
On Saturday, June 21, 2014, Paul D Anderson via Digitalmars-d-learn < digitalmars-d-learn puremagic.com> wrote:Does enum have any effect on functions?I think that's just a parser bug.
Jun 21 2014