[Issue 17474] non-property being treated as a property

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 14 07:08:58 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17474

--- Comment #10 from anonymous4 <dfj1esp02 at sneakemail.com> ---
(In reply to Stefan Koch from comment #5)
> I am pretty sure the last thing you want is a function to be invoked as a
> setter property if it returns an Lvalue.

AFAIK it's deliberate as this way you can implement getter and setter with one
function. The right semantics here will be difficult to define due to sheer
number of reasons why a(b) may fail to compile and which of them should be
skipped and which shouldn't.

(In reply to Eyal from comment #8)
> Requiring @property on a for a=b to invoke a(b) sounds much more reasonable
> than the opposite.
> 
> I don't see how a=b invoking a(b) when a isn't a @property is justifiable.

It reduces code littering (and it's not easier to check). UFCS relies on
property syntax too.

--


More information about the Digitalmars-d-bugs mailing list