On 12/31/20 8:54 PM, Adam D. Ruppe wrote:
On Friday, 1 January 2021 at 01:43:50 UTC, Chris Bare wrote:
        a1[10] = "testing a1";

this actually constructs a new thing since it is a straight x = y assignment.

        a2[10].name = "testing a2";

But this looks up something first. It doesn't construct a2[10], it looks it up first to fetch the name member... hence the range violation since it isn't constructed yet.


        a3[10] = new Project;

and this again will construct since it is a straight x = y again.



So you could also do

a2[10] = Person()

then do the lookup of name

or a2[10] = Person(null, "testing a2")

-Steve

Reply via email to