Why are opCall's not implicitely assignable?
Karen Lanrap
karen at digitaldaemon.com
Fri Sep 22 07:10:41 PDT 2006
Stewart Gordon wrote:
> It's distinguishable at the moment by whether the lvalue is a
> variable or a function.
>
> Trying to add a further dependence on the type of the rvalue
> would make the language more complicated and possibly harder to
> understand.
This harder understanding is introduced by the existing syntax sugar
already.
You explain it yourself: reading any "x=y;" one has to know whether
"x" is a variable or a function because of that syntax sugar.
But
1. what is the difference between a variable and a function?
2. why should one stop introducing further dependencies?
Number 1 may sound silly, but Walter has introduced the assignment to
functions as means of a call---and thereby diluted the differences
between both concepts.
In fact "real r='\n';" is already a dilution of what a variable is by
means of implicit conversion.
Number 2 is only driving the properties of implicite conversions
further into the control of the user.
"real r='\n';" could very well, and with an apropriate function f, be
replaced by "real r=f('\n');" and this with the short hand to "real
r=f='\n';"
More information about the Digitalmars-d-learn
mailing list