Re: "Nasty" bug
- Posted by irv Feb 25, 2019
- 2062 views
This problem would have continued unnoticed had the original author of the code written it in such a way as to conceptualize the actions in code first. I have to imagine that the code posted was merely an example to demonstrate the problem, but that worries me even more as to what the author's original code looks like!
The original code was lost_ball.ex, linked above. It appears to be a Eu translation from some other language, perhaps basic, which of course makes it messy. Probably just an accident that the one line happened to uncover a problem. The code I show was the original pared down to the minimum to show the error.
There's an additional "gotcha" involved. Some experimenting I did:
sequence our_place = {{0}, {{0,0,0,0,0}} } -- fails sequence our_place = {0,{{0,0,0,0,0}} -- make first an atom, our_place[1] += you( ball ) -- and it works
If the first element of the sequence is an atom, the problem doesn't occur.