On 2011-06-10 22:08:31 -0400, Andrei Alexandrescu <seewebsiteforem...@erdani.org> said:

On 6/10/11 8:08 PM, Michel Fortin wrote:
On 2011-06-10 18:57:20 -0400, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> said:

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.

I actually didn't meant to post the above. I wrote it, then thought I should sleep on it before deciding whether I'd post it or not since I was a little to tired. Then I hit a bad key combo and the message reached the server before I could unplug my network cable. I'm not surprised you could find some inconsistencies in it.


--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/

Reply via email to