Review of std.signal

Robert jfanatiker at gmx.at
Thu Nov 14 07:40:47 PST 2013


>
> Enums in D may be scoped. There is nothing that prevents you 
> from declaring your enum thus:
>
> enum { protected_, private_, none }
>
> making the shorter version perfectly legal.
>
> mixin(signal!(string, int)("valueChanged", protected_));
>
> Your concern about extra typing by always needing to specify 
> the scope is thus unwarranted.

This would work, but would make the protection parameter an int. 
Not really any more beautiful than a string. The advantage of the 
enum for me was, that it is clear from the signature what are 
valid protections, this advantage gets lost with an anonymous 
enum.

The only remaining advantage would be tool support for 
completion, but I don't think it is worth it.


More information about the Digitalmars-d mailing list