quarkiverse / quarkus-bon-jova-rockstar

An implementation of Rockstar as a JVM language
https://codewithrockstar.com/
3 stars 2 forks source link

Arrays need to be initialised before accessing them in a loop or the length stays at 1 because they are constantly re-initialised #110

Open holly-cummins opened 7 months ago

holly-cummins commented 7 months ago

See, for example, the rock your universe I had to add in the mandelbrot.rock, or a similar adjustment in the 1brc.rock. I've added a disabled reproducer in the shouldHandleInitialisingArrayInLoop test.

The early initialisation shouldn't be needed, and isn't in Satriani. It's something to do with the array being initialised in the narrower scope and then not being seen as initialised in the next loop, which means it gets re-created.