Frist Draft (in this forum): Enum Parameters
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sat Apr 27 21:30:24 UTC 2024
On 26/04/2024 11:29 AM, Quirin Schroll wrote:
> On Thursday, 25 April 2024 at 20:29:27 UTC, Richard (Rikki) Andrew
> Cattermole wrote:
>> […]
>>
>> If however it resulted in that function parameter being treated as a
>> template parameter that would be different. But I don't see anything
>> that suggests this.
>
> But that is exactly what I propose.
>
> Quoting from the draft:
>
>> In the function body (including contracts and constraints), an `enum`
>> parameter’s value is a compile-time constant as if it were template
>> value parameter.
>> The same is true for `this` in an `enum` non-`static` member function
>> body.
>> The main difference between `enum` parameters and template value
>> parameters is only in calling syntax:
>> `f!ct_value(args)` versus `f(ct_value, args)`.
>> Another difference is that the type of an `enum` parameter can be
>> inferred, while a template value parameter must have its type specified.
It wasn't jumping out at me, so this could do with some reworking.
More information about the dip.development
mailing list