Re: Getting consistent behavour for class properties

2016-10-09 Thread mikey via Digitalmars-d-learn
On Monday, 3 October 2016 at 14:05:24 UTC, Kagamin wrote: I suppose that's https://issues.dlang.org/show_bug.cgi?id=8006 Yes, exactly. Although, I don't see why they wrap it in a struct in the example as this seems to me to just obfuscate the issue.

Re: Getting consistent behavour for class properties

2016-10-03 Thread Kagamin via Digitalmars-d-learn
I suppose that's https://issues.dlang.org/show_bug.cgi?id=8006

Re: Getting consistent behavour for class properties

2016-10-02 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 2 October 2016 at 17:10:58 UTC, mikey wrote: There is already a degree of transparency with how properties being handled for example in allowing properties to be an lvalue if they have a setter. t.val = 42; Actually, this is not specific to properties, as it also works on

Re: Getting consistent behavour for class properties

2016-10-02 Thread mikey via Digitalmars-d-learn
On Sunday, 2 October 2016 at 14:44:13 UTC, Lodovico Giaretta wrote: Yeah, a property is quite different from a variable. In fact, a property may refer to a computed value, which may not have an address and as such cannot be modified: [...] So it is correct that `+=` doesn't work with

Re: Getting consistent behavour for class properties

2016-10-02 Thread Lodovico Giaretta via Digitalmars-d-learn
On Sunday, 2 October 2016 at 14:26:46 UTC, mikey wrote: [...] Yeah, a property is quite different from a variable. In fact, a property may refer to a computed value, which may not have an address and as such cannot be modified: @property auto currentTimeMillis() { return

Getting consistent behavour for class properties

2016-10-02 Thread mikey via Digitalmars-d-learn
Hi, I'm experimenting with the behaviour of properties in D, as I am writing some classes that are being used in a mixture of const and non-const functions. I've found a couple of things that I'd just like to check. First perhaps I should say what I would expect from working with

Re: Getting consistent behavour for class properties

2016-10-02 Thread mikey via Digitalmars-d-learn
On Sunday, 2 October 2016 at 14:26:46 UTC, mikey wrote: t.val = t.val + 1; t.val += t.val; Sorry that should have of course read: t.val = t.val + 1; t.val += 1;