DIP proposal: Enum parameters
Quirin Schroll
qs.il.paperinik at gmail.com
Tue Sep 27 13:46:48 UTC 2022
On Tuesday, 27 September 2022 at 12:23:18 UTC, bauss wrote:
> On Tuesday, 27 September 2022 at 12:13:53 UTC, Paul Backus
> wrote:
>> On Tuesday, 27 September 2022 at 11:52:03 UTC, bauss wrote:
>>> Like how is this:
>>>
>>> ```
>>> auto opSlice()(enum size_t l, enum size_t u) => slice!(l, u);
>>> ```
>>>
>>> An improvement over:
>>>
>>> ```
>>> auto opSlice(size_t l, size_t u)() => slice!(l, u);
>>> ```
>>>
>>> Maybe I am not entirely grasping this concept or something.
>>
>> The only difference is that at the call site, you can write
>> `opSlice(i, j)` instead of `opSlice!(i, j)`. It's pure syntax
>> sugar.
>
> Yeah that's what I thought.
>
> I'm not for this particular DIP then. I think adding more
> keywords is going to make the language much more messy.
You probably mean adding more language constructs. `enum` is
already a keyword. Compile-time values are already a thing in D.
It would be valuable if you provide examples or some further
explanations that demonstrate the mess introduced.
More information about the Digitalmars-d
mailing list