h3rald / min

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

Sealing #134

Closed ghost closed 3 years ago

ghost commented 3 years ago
$ (scope puts "!" sealed-symbol?) =>
{;module}
 (
   {;module}
   true
  )

Why did it show true? Because i didn't define any symbol in the scope of quot.

I am scaring to use scopes 😱

h3rald commented 3 years ago

Well, if it doesn't find the symbol in the current scope it goes up the scope chain...

ghost commented 3 years ago

Well, if it doesn't find the symbol in the current scope it goes up the scope chain...

This isn't what we expected from it.

h3rald commented 3 years ago

Well... it may seem unusual but if that didn't work that way, you wouldn't be able to use those methods inside foreach, while, map etc. it works in the same way as lexical scoping: if the symbol is not found, it goes up the scope chain.