Dynamic Binding - Confusion!

What's "dynamic binding"? The definition I'm used to states that with dynamic binding the environment of a function application is determined by the function's caller, instead of it being determined statically by the location of the function's definition. Dynamic binding can be implemented using a stack instead of the more complicated static environments that typically need some kind of garbage collection. Old programming languages (such as old Lisp dialects) used dynamic binding, simply because it was the most obvious implementation, and it was easier. Dynamic binding can also be seen in some languages that still remain in usage, such as ELisp and Perl (when variables are not defined using the my prefix). This "dynamic binding" may also be referred to as "dynamic scoping".

The other definition of "dynamic binding" is in object orientation, when the exact method being applied to an object isn't decided until the actual application occurs. Polymorphism cannot exist without this dynamic binding. Also called "late binding".

So obviously two definitions of the same term, this is bound to cause confusion and is the reason I scoffed at my software engineering book when it stated that it was very hard to unit test systems utilizing dynamic binding (of course, that is much more the case with the former definition of dynamic binding, but I found the mere fact that they mentioned it utterly awkward.) Though I really want to keep calling "dynamic scoping" "dynamic binding" (has a nicer ring to it!) I guess I'll settle for the advantages of unambiguity. I'd suggest you do the same.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. Beside the tag style "<foo>" it is also possible to use "[foo]".

More information about formatting options