Enum literals, good? bad? what do you think?
Adam D Ruppe
destructionator at gmail.com
Wed Jul 21 22:22:45 UTC 2021
On Wednesday, 21 July 2021 at 07:12:25 UTC, Mike Parker wrote:
> ```d
> enum expandEnum(EnumType, string fqnEnumType =
> EnumType.stringof) = (){
Eeek, this is awful. It uses .stringof which means it is
automatically stinky. It is liable for trouble when anything
other than basic imports get involved.
If you are going to do this kind of thing as a mixin at all, a
mixin template is far more appropriate. It avoids the scope
trouble since it can use the unambiguous local name.
But when there's `with`.... none of this stuff gains you
anything. It doesn't get closer to the Swift examples.
More information about the Digitalmars-d
mailing list