DIP proposal: Enum parameters
Quirin Schroll
qs.il.paperinik at gmail.com
Mon Sep 26 07:48:13 UTC 2022
On Friday, 23 September 2022 at 16:44:05 UTC, Quirin Schroll
wrote:
> On Friday, 23 September 2022 at 16:17:01 UTC, ryuukk_ wrote:
>> ``enum`` is supposed to be an enumeration, not a _ for compile
>> time usecase, in fact, ``comptime`` is a better name, so i
>> personally would love if it was changed to that, if that's
>> possible.
>
> It probably must be an existing keyword. `comptime` would be
> possible as a contextual keyword, something Walter opposes.
> `static` is the only other candidate. I’ve looked through the
> whole [list of
> keywords](https://dlang.org/spec/lex.html#keywords).
Nevermind. I just found out that [attributes for function
parameters](https://dlang.org/spec/function.html#Parameters) are
a thing as of late. As with `@safe`, `@nogc` and `@property`,
`@comptime` could be another compiler-recognized attribute.
As a member function attribute, `@comptime` intuitively looks
more like it means that the function can only be used for CTFE
and never at run-time (cf.
[`consteval`](https://en.cppreference.com/w/cpp/language/consteval) in C++; something like this was suggested for D before).
More information about the Digitalmars-d
mailing list