[Issue 9498] Rang violation using AA

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 29 22:59:50 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9498



--- Comment #6 from yebblies <yebblies at gmail.com> 2013-06-30 15:59:48 EST ---
(In reply to comment #5)
> 
> Actually D does not have notion of lvalue context - TDPL says about read and
> write operations. According to it, returning from function is a read operation.
> 

TDPL does not completely define the language.  Unfortunately neither does the
spec, it is defined through a combination of TDPL, the spec, and DMD.  When
these disagree none are a definitive source.

The compiler most certainly has a notion of lvalue context for index
expressions.

> And function refness does not guarantee that original lvalue will be modified.
> The use case could be:
> 
> int a = get(); 
> 
> which means refness is wiped out and operation is effectively a read operation.
> Situation could be follows:
> 
> ref int foo() { return aa["asd"]; }
> int bar() { return aa["asd"]; }
> 
> not only this is confusing and inconsistent, but it defeats the purpose of
> having aaGetRvalueX - anyone who want allocation would be just putting ref to
> function declaration to make things works.

I'm not sure how any of this is relevant.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list