T opImplCast(T)() so we can add @disable to it?

Sjoerd Nijboer sjoerdnijboer at gmail.com
Thu May 24 01:13:56 UTC 2018


> I would REALLY love a way to implement an implicit cast that 
> wasn't `alias this` based... for reasons that are NOT to 
> @disable it :P

Well, explicit casts can be annoying at times when type 
conversion wouldn't mean loss of precision, but disabling an 
implicit cast on any type that has such casts right now means 
wrapping it in a struct and forwarding all calls to that type 
except for the type. At that moment you have no implicit casts. 
(Maybe some explicit ones if you forwarded those.)
But this sounds like a lot of boilerplate and a worse debugging 
experience.


More information about the Digitalmars-d mailing list