h3rald / min

A small but practical concatenative programming language and shell
https://min-lang.org
MIT License
311 stars 23 forks source link

'withScope' does not return old scope on exception #27

Closed Esgorhannoth closed 6 years ago

Esgorhannoth commented 6 years ago

While playing in REPL, I typed something like this

[path]$ ("a string" puts!") ->
(!) <repl>(1,14) [puts!"]: Undefined symbol 'puts!"'
    <repl>(1,14) in symbol: puts!"
    <native> in symbol: dequote
    <repl>(1,18) in symbol: ->

and after that Tab-completion stopped working. So I got my nose into the source and found out that the template withScope in core/interpreter.nim does not handle exceptions in body passed to it. I suggest wrapping body and scope restoring lines in try...finally.

h3rald commented 6 years ago

Thanks! Fixing now...