Flag proposal

Jonathan M Davis jmdavisProg at gmx.com
Fri Jun 10 11:15:54 PDT 2011


On 2011-06-10 10:57, KennyTM~ wrote:
> On Jun 11, 11 01:42, Robert Clipsham wrote:
> > On 10/06/2011 17:15, Andrei Alexandrescu wrote:
> >> https://github.com/D-Programming-Language/phobos/pull/94
> >> 
> >> Discuss!
> >> 
> >> Andrei
> > 
> > I really *really* don't like this. It's ugly and verbose, and a pathetic
> > work around for the lack of named parameters. Either support named
> > parameters or not, don't have an ugly half-baked work-around.
> 
> Well I agree it is ugly, but at least it's better than having the same
> enum 7 times in Phobos (std.stdio.KeepTerminator,
> std.string.CaseSensitive, std.algorithm.OpenRight,
> std.algorithm.SortOutput, std.datetime.AllowDayOverflow,
> std.datetime.PopFirst, std.datetime.AutoStart).
> 
> If named parameter is supported, those Flag!"foo" parameters can be
> reverted back to bool without breaking the caller as the enum is based
> on bool.

And there are places in Phobos which _should_ be using enums like this but 
aren't (e.g. std.file.dirEntries' followSymlinks bool), so the number is only 
going to go up as such things are fixed, even without adding new code to 
Phobos. And of course, we're going to be adding new code, so the amount of 
duplication for this type of enum is only going to go up.

- Jonathan M Davis


More information about the Digitalmars-d mailing list