riff icon indicating copy to clipboard operation
riff copied to clipboard

`eval()` should be able to resolve local variables

Open darrylabbate opened this issue 2 years ago • 1 comments

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.

darrylabbate avatar Dec 30 '22 00:12 darrylabbate

Probably makes sense to implement #22 first and see if the methodolgy can be applied to interpolated string expressions.

darrylabbate avatar Dec 23 '23 05:12 darrylabbate