You might expect this to print a million hello worlds:
It does. If you compile in debug mode.
In release mode the garbage collector thinks the list is ready to be collected, when it sees there is no code to operate on the variable - it gets collected before l goes out of scope.
Took me a long while to find one of these in a larger project...
SuperStrict Framework BRL.StandardIO Import BRL.LinkedList Local l:TList = New TList l.AddLast "Hello " l.AddLast "World" Local link:TLink = l.FirstLink(), s:String For Local i:Int = 1 To 1000000 s = String(link.Value()) link = link.NextLink() s:+ String(link.Value()) link = link.PrevLink() Print s Next
It does. If you compile in debug mode.
In release mode the garbage collector thinks the list is ready to be collected, when it sees there is no code to operate on the variable - it gets collected before l goes out of scope.
Took me a long while to find one of these in a larger project...