Review of std.signal
John Colvin
john.loughran.colvin at gmail.com
Thu Nov 14 09:20:25 PST 2013
On Thursday, 14 November 2013 at 15:40:49 UTC, Robert wrote:
>>
>> 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.
enum Protection { protected_, private_, none }
alias protected_ = Protection.protected_;
alias private_ = Protection.private_;
alias none = Protection.none;
Best of both worlds?
More information about the Digitalmars-d
mailing list