Allow Conditional Compilation Inside Enum Declaration
Hipreme
msnmancini at hotmail.com
Tue Apr 2 17:19:54 UTC 2024
On Sunday, 31 March 2024 at 02:36:40 UTC, IchorDev wrote:
> On Saturday, 30 March 2024 at 22:34:46 UTC, monkyyy wrote:
>> As a [specific] case or for all lists?
>>
>> Could you do this for functions `foo(static if(bar){1},2)`?
>
> I’m not sure if that’s really in the scope of this idea. Maybe
> that could be another proposal?
>
>> is changing the meaning of {} nessery or should it be for
>> single elements?
>> `enum A{x,y,z, static if(cond) w}`
>
> I don’t see why that would be necessary? Ideally it should work
> just like any existing conditional compilation. (e.g. also
> allowing `version(Something):`, etc.)
My main take against that, is that it would be harder to make it
compatible when using libraries. One value could change:
```d
enum A
{
static if(cond) w,
x,
y,
z
}
```
And boom! Depending on how you're using, one may:
1. Break
2. Worse: create surprising behavior because, if you use X, it
will become Y which is still valid.
Although the idea does make sense in some aspects, I fear for the
worst
More information about the dip.ideas
mailing list