Review of std.signal

Tyro[17] ridimz at yahoo.com
Thu Nov 14 05:55:19 PST 2013


On 11/14/13, 8:40 AM, Robert wrote:
>> * Isn't it better to use an enum for the protection attributes?
>
> Having put some thought into this, while it seems to be, I think it isn't.
> Enums in D are scoped, so for the enum:
>
> enum Protection { protected_, private_, none }
>

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.



More information about the Digitalmars-d mailing list