Function undefinition did not work because the previous definition was overwritten before being saved, and so restoring it was a no-op.
This meant functions with intermediate state could be produced, potentially violating invariants. For example, the following creates a function with a partial body but without any locals, eventually leading to an index out of range when trying to access the local b:
op inc b =
b + 1
|
inc 1
$ ivy <crash.ivy
unexpected EOF
panic: runtime error: index out of range [-1] [recovered]
panic: runtime error: index out of range [-1]
goroutine 1 [running]:
...
Function undefinition did not work because the previous definition was overwritten before being saved, and so restoring it was a no-op.
This meant functions with intermediate state could be produced, potentially violating invariants. For example, the following creates a function with a partial body but without any locals, eventually leading to an index out of range when trying to access the local
b
: