riff
riff copied to clipboard
`eval()` should be able to resolve local variables
For comparison, Python's eval()
does have access to locals; Lua's load()
does not.
Obviously this is a side-effect of how locals are compiled. It's not possible for eval()
to know the identifiers of any corresponding in-scope locals since it's thrown away at compile-time. And when eval()
calls riff_compile()
, a fresh riff_parser
is initialized. Even if a single riff_parser
was used, it obviously doesn't necessarily mean existing locals would be visible since riff_parser.locals
is effectively a stack.
Probably makes sense to implement #22 first and see if the methodolgy can be applied to interpolated string expressions.