Why are opCall's not implicitely assignable?

Karen Lanrap karen at digitaldaemon.com
Thu Sep 21 15:43:08 PDT 2006


Stewart Gordon wrote:

> If it did, then how would you
> assign object references of classes that have opCall at all?

The answer is easy: the opCall for a reference of its own class 
should be disallowed.

By the way: the ._= seems to be a useful shorthand for overloading an 
assignment :-)

 
> Similarly,
> 
>      void function(int) qwert;
>      ...
>      qwert(yuiop);   // calling the pointed-to function
>      qwert = asfdg;  // changing which function is pointed to

That is also easy: no qwert can have its own type as a single 
parameter. Otherwise show me an example.

Therefore its distinguishable whether a "=" is a call or an 
assignment.



More information about the Digitalmars-d-learn mailing list