mica-lang / mica

A simple, amicable, embeddable scripting language
MIT License
33 stars 3 forks source link

Remove the ability to create global variables outside of corelib #134

Open liquidev opened 1 year ago

liquidev commented 1 year ago

To ensure a predictable and consistent environment for all Mica scripters, I believe the ability to create globals should be reserved for the core library, and embedders should use modules (#74) instead. Following that, scripts should not set global variables, but rather return module tuples to pass things back to the embedding program.

liquidev commented 1 year ago

One concern I have with this is that this'll make the REPL effectively useless, since local variables are not visible from one chunk to another. Then maybe the correct way would be to make global variables opt-in during script compilation, for REPL purposes.