D's "accessors" are like abusing operator overloads
BCS
none at anon.com
Fri Mar 27 09:03:39 PDT 2009
Hello Denis,
> On Fri, 27 Mar 2009 18:53:51 +0300, BCS <none at anon.com> wrote:
>
>> One option would be to only allow that fn = v syntax where fn returns
>> void.
>>
> Obscure rule and a bad idea in general. This way you can't do "a = b =
> c = 42;"-style chaining.
>
I'd say that chaining example would be a bad idea anyway. strange things
would start happening if b or c altered the value or returned a different
type. One option, if you insist on chaining working, would be to restrict
it to void returns and have the expression evaluate to the RHS.
More information about the Digitalmars-d
mailing list