Revised RFC on range design for D2
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Sep 29 11:38:41 PDT 2008
Sergey Gromov wrote:
> Mon, 29 Sep 2008 12:23:58 -0500,
> Andrei Alexandrescu wrote:
>> Sergey Gromov wrote:
>>> D has a simple rule for property methods. This rule has side effects.
>>> If the side effects are so bad that a hack is required to counter them,
>>> then the rule should be replaced with a better one. Otherwise your hack
>>> will inevitably introduce new, less obvious side effects than those it
>>> were supposed to fight, and will finally require other hacks.
>>>
>>> struct Range
>>> {
>>> ref int head() {...}
>>> }
>>> Range r;
>>> r.head = 5; // error
>> A function can return an object that allows assignment even today with
>> opAssign.
>
> Today the compiler tries to call Range.head with one argument and fails.
> Another side effect needs hacking.
Well I'd rather say, an awkwardness that needs fixing.
Andrei
More information about the Digitalmars-d-announce
mailing list