Flag proposal

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 10 12:30:13 PDT 2011


On 2011-06-10 09:15, Andrei Alexandrescu wrote:
> https://github.com/D-Programming-Language/phobos/pull/94
> 
> Discuss!

I do have to admit that as much as I hate the idea of named parameters, this 
particular proposal certainly seems to be an argument in favor of adding them, 
which would tend to argue against making these changes.

After thinking about it, I'd argue that it would be better to create a string 
mixin which created the enums for you instead of using the template as part of 
the arguments. e.g.

mixin(YesNoEnum!"KeepTerminator"));

Then all of the rest of the code is the same. You'd still use 
KeepTerminator.yes and KeepTerminator.no, but we avoided having to create 
duplicate enums by hand every time that we want this kind of variable. So, you 
still reduce the boilerplate code, but the usage is much less ugly.

- Jonathan M Davis


More information about the Digitalmars-d mailing list