-
Notifications
You must be signed in to change notification settings - Fork 6
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
Inconsistencies in @closure
semantics
#11
Comments
more possible names...
|
+1 for |
Actually just |
|
Looking back, I can't say I'm entirely happy with any of the names above. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The semantics of variable capture in
@closure
were originally intended to be the same as julia, but I got this wrong because at the time I didn't understand the intended semantics of the core language which is that the value associated with a name may be changed either within the closure or within the surrounding function and in both of these cases the change must be dynamically reflected in the other scope.In particular, the value of
x
in the following is modified outside the closure, followed by returning closure, and there's nothing@closure
can know about this:On the other hand,
@closure
does quite a bit of work to allow the following pattern to work the same as in the core language:(Though
x+=10
doesn't appear to work... I guess that's a bug. Ugh!)In hindsight I think this makes the semantics
@closure
pretty confusing and it would be better to just freeze all bindings inside the closure to fix them to the values they had at closure creation time. See also some discussion in #5 (CC @bramtayl)Some possible names for such a macro...
The text was updated successfully, but these errors were encountered: