Make enum auto castable

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 4 18:33:55 PDT 2017


On Monday, June 05, 2017 01:12:20 Mike B Johnson via Digitalmars-d-learn 
wrote:
> Well, I do need to to treat it as an int at times and opCast only
> works with cast. While I could set it up to do a cast(VARIANT),
> which is better than nothing, I'd get same result as to!VARIANT,
> which is shorter and effectively the same.
>
> When will we get multiple alias this? all I need is two?
>
> Hell, why not make alias this an "overloadable" function similar
> to opCast and such?

I don't know when we're getting multiple alias thises. TDPL talks about it
being a thing, and the spec claims that it's a thing, but until someone
implements it, we won't have it, and it hasn't been a priority for Walter.
IIRC, someone tried to implement it at one point, but I don't know where
that went. There was a thread in the main newsgroup a couple of months ago
about how to simulate multiple alias thises, so you might want to check that
out:

https://forum.dlang.org/post/uniyvmvjopeyyxmphfso@forum.dlang.org

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list