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.

Reply via email to