-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarify variable scope, as in... #47
Comments
f2=func() {
log("called f2", n) // log output
n
}
f1=func() { // function
log("called f1", n) // log output
n=n-1
log("n in f1 now", n)
f2() // still bound to top-level env not this one
}
n=5
f1() maybe f2() called into f1() should refer to f2's env not the env it was created in...? or have some option or have or have |
it's kind of nice as is, so far, all pure functions that we memoized automatically in #72 might reopen and add |
Ok so while trying to trigger an error when a function parameter is a CONSTANT identifier, I stepped on this again Decided to do the following (in #102 ) : The environment when calling into a function body is either:
Note this only works for direct recursion, a->b->a would use env of a as when defined, not the first a |
todo: might have messed up the rebase conflicts
…ment. Fixed bug with macro environment. Added pprof. (#102) * ALL_CAPS are now constants - manual tested for all but recursion which is oddly not triggering * Add comments, rename IsConstantIdentifier-> more go style Constant() * fix mixup between macro env and eval state env; add tests for constant; allow resetting to same exact value; tinygo workaround for tinygo-org/tinygo#4382 * fix foo++ returning foo+1 instead of foo (only return error if FOO++) * fix usage of N in pi.gr; log setting constant as info * big change in recursion environment, see comments and #47 (comment) todo: might have messed up the rebase conflicts * add test for presence/absence of == Macro ==> step * linters * Adding examples showing huge perf regression * adding pprof option to main() and found the issue with recursion not using self * unrelated fix for wasm/web share: preserve the tabs * replace 2 log.Fatalf by return log.FErrf for consistency * Apply suggestions from code review Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com> * add missing import --------- Co-authored-by: ccoVeille <3875889+ccoVeille@users.noreply.github.com>
can read from any scope but only write in current one
The text was updated successfully, but these errors were encountered: