rink-rs
rink-rs copied to clipboard
Draft: Add variable definitions via let
As came up in #104, i took a look at adding variable definitions via let x = expr
.
Still some things to figure out:
Right now, it's possible to set variables to names which then are inaccessible because they are masked by a unit with the same name.
I'd like to probably change lookup slightly so it also returns the type of the lookup result, so before setting a variable, we can check whether there already is something other than a variable with this name and refuse. I think silently redefining variables with another let
is fine, though.
Again, any thoughts or ideas are appreciated :)
Oops, broke the tests /o\
I actually took a quick look at the tests when working on #104 and wanted to add a test for accessing the previous result, but couldn't figure out how to make the thread local context also mutable...
It might also make sense to refactor these tests to use lib::eval()
?