toImpl deprecated, use opCast instead?

Manu turkeyman at gmail.com
Thu Jun 7 06:47:08 PDT 2012


Seriously?

I perceive to!T and cast(T) as fundamentally different operations. How can
opCast correctly perform the role of to! ?
cast() is a low level type cast, to! implies a conversion of some kind. If
you have a pointer type, I assume cast to operate on the pointer, and to!
to perform a conversion of the thing it represents.

to!int("12345")  or  cast(int)"12345"
to!JSONValue(obj)  or  cast(JSONValue)obj
cast(string)obj  <- appears to be a primitive cast operator, communicates
nothing to me about the expected format of the string produced

The cast approach feel really wrong to me...

I need to do conversion between some fairly complex types. to! feels
appropriate, but cast() just seems weird...
Have I missed something?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120607/1a089fa9/attachment.html>


More information about the Digitalmars-d mailing list