associative array: unexpected results after static initialization

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Dec 1 18:30:27 UTC 2017


On Fri, Dec 01, 2017 at 01:14:14PM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote:
> On 12/1/17 12:02 PM, H. S. Teoh wrote:
> > On Fri, Dec 01, 2017 at 11:59:08AM -0500, Steven Schveighoffer via Digitalmars-d-learn wrote:
> > > So I would say we should define that the last key/value combo
> > > takes precedence, and it would be good to ensure that's the case
> > > with a test.
> > 
> > Sure, but that means a spec update besides the unittest addition.
> 
> I'm not sure it even needs a spec "update", as there is no spec for it
> :)

What I meant is, the AA spec needs to be updated to specify this
behaviour. :-)  Otherwise, it opens up the chance of somebody
implementing an alternative D compiler (let's say, SDC, just for an
actual example) that exhibits a different behaviour and breaking user
code.


> But having the unit test at least ensures that someone implementing
> something different (though I don't ever see it happening) will notice
> the test.
> 
> As of now, someone can be depending on this behavior, and then such an
> implementation rewrite could get through and break their code.
> 
> I'll write a unit test, shouldn't be too hard.
[...]

Maybe I'll take a shot at updating the AA spec.


T

-- 
Never step over a puddle, always step around it. Chances are that whatever made it is still dripping.


More information about the Digitalmars-d-learn mailing list