Re: The problem with D's properties

2018-05-30 Thread Mike Franklin via Digitalmars-d
On Thursday, 31 May 2018 at 01:49:42 UTC, DigitalDesigns wrote: https://dpaste.dzfl.pl/6c6e614b58ac The problem given in the list, is that a ref getter is used when a setter does not exist. Why have a setter then? One problem is that if the setter has different behavior than the getter

Re: The problem with D's properties

2018-05-30 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 31 May 2018 at 01:49:42 UTC, DigitalDesigns wrote: Using setters, we might want to trigger an event when the value changes. But since the getter is used and can modify the event won't be triggered. This is a bad design. Here's similar bad design: --- class Int { public int

Re: The problem with D's properties

2018-05-30 Thread Arun Chandrasekaran via Digitalmars-d
On Thursday, 31 May 2018 at 01:49:42 UTC, DigitalDesigns wrote: https://dpaste.dzfl.pl/6c6e614b58ac The problem given in the list, is that a ref getter is used when a setter does not exist. Why have a setter then? [...] Please report issues at https://issues.dlang.org otherwise it will be

The problem with D's properties

2018-05-30 Thread DigitalDesigns via Digitalmars-d
https://dpaste.dzfl.pl/6c6e614b58ac The problem given in the list, is that a ref getter is used when a setter does not exist. Why have a setter then? One problem is that if the setter has different behavior than the getter there will be problems. The other problem is that += modifies the