4 ms·
How do you copy a variable? You can only copy values. A free variable has no value. You're confusing capture with closedness. Here's a trivial example: \
by octoberfranklin 5y ago
How do you copy a variable? You can only copy values. A free variable has no value. You're confusing capture with closedness.
Here's a trivial example:
\f -> \y -> (runRemotely (\x -> f y x))
The expression passed to runRemotely has a free variable "y". How are you going to serialize (\x -> f y x) in order to send it across the network? When you hit the "y", what are you going to do?
For this trivial minimalist example you might cook up a one-off hack like lambda-abstracting the free variables in the runRemotely expression and then reapplying to the returned value, but there are much more complicated and insidious examples where these workarounds don't work.
- beecafe 5y agoUse typed holes
- octoberfranklin 5y agoYou can't serialize holes. You can't even compare them for equality (partly because it is far from clear what that should even mean).
- pharmakom 5y agoI was talking in the context of pure functional programming. You can send the AST of a lambda.
- octoberfranklin 5y agoTHERE IS NO LAMBDA. It's a free variable, not a variable bound by a lambda.