1
votes

What is the difference between "ad-hoc" binding and "deep" binding?

1

1 Answers

3
votes

Deep binding captures the environment at the point where a lambda is constructed. As far as I know, C# and Scheme both behave this way.

Shallow binding just looks for the most recent binding of a variable on the environment chain.

Ad-hoc binding is kind of hacky: a lambda grabs the environment at the point of a call when it gets passed as an argument. It gets around the problem of lambdas inadvertently binding to local variables in the function they get passed into without the complexity of implementing deep binding, but the illusion breaks down if they get passed on further because it's still just a slight modification of shallow binding.