Scarpet list entry at index `0` can be accessed with index `null`
rv3r opened this issue ยท 2 comments
foo = [3,4,5];
get(foo,null) => 3
foo:0 == foo:null => true
delete(foo:null); foo => [4,5]
foo = [1];
has(foo,null) => true
foo = [];
has(foo,null) => false
Bug or working as intended? I ask mostly because it isn't mentioned in the docs and it messes up deleting specific entries as seen below
bar = ['a','b','c']
delete(bar,bar~'a'); bar => ['b','c']
// a isn't in the list, so index returns null, delete is still happy to nuke entry at index 0 though
delete(bar,bar~'a'); bar => ['c']
It is definitely intended for null
to act as zero for most stuff, and I'd assume this to be too given it's caused directly by that, though I'm not sure.