opCast overloading and opCast_r

nazo lovesyao at gmail.com
Fri Dec 1 06:14:42 PST 2006


I think that cast is binary operation with value and type. And I made 
groundless patch(I tested with dmdfe and gdc-2.0-dev). This idea break 
old opCast call and have side effects like allowing "cast(value)". But 
it support other pattern like "type + value". How about this idea?
#sorry for my poor English

val_a op val_b (Example: a + b)
val_a.opfunc(val_b)
val_b.opfunc_r(val_a)

val op type (Example: a + B, cast(B)a)
val.opfunc!(type)()
type.opfunc_r(val)

type op val (Example: A + b)
type.opfunc(val)
val.opfunc_r!(type)()

type_a op type_b (Example: A + B)
type_a.opfunc!(type_b)()
type_b.opfunc_r!(type_a)()

-------------- next part --------------
A non-text attachment was scrubbed...
Name: opcast_r2.diff
Type: text/x-patch
Size: 12504 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20061201/dbab29f0/attachment.bin>


More information about the Digitalmars-d mailing list