"Andrei Alexandrescu" <seewebsiteforem...@erdani.org> wrote in message news:isuivh$1a6v$1...@digitalmars.com... > On 6/10/11 8:08 PM, Michel Fortin wrote: >> On 2011-06-10 18:57:20 -0400, Andrei Alexandrescu >> <seewebsiteforem...@erdani.org> said: >> >>> On 6/10/11 5:25 PM, Michel Fortin wrote: >>>> A hack is something that works even though it's ugly and generally >>>> cause >>>> people to call for something better. I'm not opposed to using hacks as >>>> long as they're well-encapsulated and not too fragile, but in this case >>>> I find the encapsulation is leaky since you need to litter your code >>>> with Flag!"" everywhere. >>> >>> https://github.com/andralex/phobos/commit/84c75336a4ef04b4c3b1924d7ac9329e744ab8e7 >>> >> >> It's >>> >> still a hack, but I'll agree it makes the encapsulation a little better >> if you use yes!"abc" at the function call point. >> >> However, I still think it's a deterioration from the user's point of >> view compared to the current situation with hand-crafted enums: it still >> requires a string, and the documentation will say func(Flag!"abc" abc), >> repeating the parameter's name unless you hand-craft a special Ddoc >> version of the function declaration. It's better than Flag!"abc".yes, >> but it's worse than Abc.yes. > > But the problem is the same today. > > enum Abc : bool { no, yes } > void fun(Abc abc = Abc.no); > > No difference. In the function declaration, the word "abc" occurs three > times. >
Which makes Flag even less of an improvement.