miniscript
miniscript copied to clipboard
Confused assignment to intrinsic functions
MM:
]@pi isa funcRef
1
]pi=pi
]@pi isa funcRef
1
]@pi
FUNCTION() // here pi is still a function
]
CL:
> @pi isa funcRef
1
> pi=pi
invalid index in SimpleVector::operator[] at C:\Users\jstrout\Documents\MiniScript-cpp\src\MiniScript/SimpleVector.h:193
Warning: assignment of unqualified local 'pi' based on nonlocal is deprecated [line 1]
> @pi isa funcRef
0
> @pi
3.141593 // here pi is a number.
>
Same situations for some other intrinsic functions like yield, time and so on.
if the function is not an intrinsic one, then it behaves just fine.
Note that only assigning one to itself can trigger this bug. If you do pi = time, it also behaves fine.
Yeah, I believe there's a check in there somewhere for when the assignment is of an identifier to itself. None of this was really intended to affect the shadowing of intrinsics, though.