[Issue 9498] Rang violation using AA

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 29 23:43:53 PDT 2013


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



--- Comment #7 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-06-29 23:43:51 PDT ---
(In reply to comment #6)
> > 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.

Than you should read again if you don't see the relevance. Function returning
AA value as discussed here is a case which should throw according to TDPL (spec
is silent unfortunately) and current D implementation in case of non-ref
functions. Presence of ref attribute does not matter because function performs
read operation in the first place. How value is returned (by ref or not) is of
secondary importance.

-- 
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