Carpet

Carpet

2M Downloads

Default iteration variables (and similar) should be `undef` outside loops in strict mode

altrisi opened this issue ยท 1 comments

commented

Currently those are initialized to Value.ZERO (0) even outside of any loops. Suggestion to make access to them the same as access to undefined variables instead in strict mode. And possibly make them to be the standard null value that is now used for undefined variables in regular mode.

protected void initialize()
{
//special variables for second order functions so we don't need to check them all the time
variables.put("_", (c, t) -> Value.ZERO);
variables.put("_i", (c, t) -> Value.ZERO);
variables.put("_a", (c, t) -> Value.ZERO);
}

CarpetContext also initializes another 3 variables similarly.

commented

These are actually completely unusable because of #1567.