June 21, 2014 enum functions | ||||
---|---|---|---|---|
| ||||
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 |
June 21, 2014 Re: enum functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul D Anderson Attachments:
| 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. |
Copyright © 1999-2021 by the D Language Foundation