opStarAssign?

Frits van Bommel fvbommel at REMwOVExCAPSs.nl
Sat Nov 24 06:22:22 PST 2007


0ffh wrote:
> Janice Caron wrote:
>  > I think that would end up being equivalent to
>  >     p = *p + n;
> 
> Si.
> 
>  > whereas what we actually want is the equivalent of
>  >     *p = *p + n;
> 
> Is that so?
> I'd guess that cases where both "x=y;" and "*x=y;" make sense are rare.
> So overloading opAssign for the parameter type might be quite sufficient.

Even if they're rare, they *do* exist (for example, a variant type that 
can store both normal types and pointers).
So for full functionality as well as plain consistency (also very 
important in a programming language) there should be an opDerefAssign.
(And opDeref instead of opStar, obviously)



More information about the Digitalmars-d mailing list