Does D have too many features?

Alex Rønne Petersen xtzgzorex at gmail.com
Sun Apr 29 20:04:29 PDT 2012


On 30-04-2012 04:37, H. S. Teoh wrote:
> On Sun, Apr 29, 2012 at 08:42:23PM +0200, Andrej Mitrovic wrote:
>> On 4/29/12, Jacob Carlborg<doob at me.com>  wrote:
>>> In principle I agree with you. But in practice this doesn't always
>>> work.  Take this for example: Prints "0" and "1" as expected. If we
>>> now change "point" to a property like this: It will now print "0"
>>> and "0". This is a silently breaking change. Sure you can change
>>> "point" to return by reference..
>>
>> This is a great point and an issue I've ran into and talked about
>> before. The compiler really ought to try and convert a call like this:
>>
>> foo.property++;
>> foo.property+=10;
>>
>> into e.g.:
>> foo.property = foo.property.opAdd(1);
>> foo.property = foo.property.opAdd(10);
>>
>> It would make for some really nice APIs if this feature was available.
> [...]
>
> To me, the compiler needs to be fixed so that anytime the return value
> of a @property is used as an lvalue, it should always try to call the
> setter function, or some kind of setter function, instead of the getter
> (unless there's no setter, in which case it's OK to call the getter).
>
> I chalk this up to a compiler issue, not a language issue.
>
>
> T
>

What you just talked about = semantics. So, it is a language issue.

-- 
- Alex


More information about the Digitalmars-d mailing list