JohnEarnest / ok

An open-source interpreter for the K5 programming language.
MIT License
587 stars 72 forks source link

`_` with out-of-bounds yields JS error #44

Closed FireyFly closed 8 years ago

FireyFly commented 8 years ago

As seen in the sample below, l_l throws a JS error when given out-of-bounds values as the left argument. Not sure what the proper behaviour is (I was hoping for trailing too-high values to be ignored).

 0 6_!5
Cannot read property 't' of undefined
refi64 commented 8 years ago

In K5, it gives a length error:

ryan@DevPC-LX:~/stuff$ rlwrap k5
2015.04.05 (c) arthur whitney
 0 6_!5
ERROR: length
0 6_!5
   ^

ryan@DevPC-LX:~/stuff$ 
FireyFly commented 8 years ago

I see. I guess it shouldn't yield a JS error though, but rather check for the out-of-bounds condition and throw its own error.