Xref: utzoo comp.lang.forth:607 comp.lang.smalltalk:712 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekcrl!tekgvs!jans From: jans@tekgvs.GVS.TEK.COM (Jan Steinman) Newsgroups: comp.lang.forth,comp.lang.smalltalk Subject: Re: Dynamic Bindings Message-ID: <4033@tekgvs.GVS.TEK.COM> Date: 4 Oct 88 19:53:51 GMT Organization: Tektronix Inc., Beaverton, Or. Lines: 43 <> Because of the run-time overhead only, NOT because: <...general dynamic binding is... one of the worst types of hidden dependency I know of. Let me give an example. (example deleted)... Now with this fairly straightforward typing error, we have produced a virtually undetectable bug. If 'a' is supposed to be bound to a procedure that returns an integer... (but is actually) a string, since the bindings all change dynamically, this will set off a chain of errors too large to comprehend!> (It's so easy to detect the Smalltalk detractors who are not actually Smalltalk users!) I'm not sure what you're argument is here. Any reasonable combination of dynamic binding, message passing, and incremental compilation should have no trouble detecting the compile-time inconsistency. Although your example is rather difficult to envision as object-oriented code, I think Smalltalk would catch your "typing error" at compile time. If you are referring to run-time behavior (that is, if you told the compiler to accept unbound selectors), the combination of message sending and dynamic binding (often referred to as "polymorphism") causes a rather simple-to-debug run-time error. In your case, the String object would report that it does not understand how to perform the Integer message it just received. Of course, if you want to guarantee that both Strings and Integers respond to a given set of messages, it is quite simple to override the default error handling to enable coercion. (This "lazy mutation" is how Tektronix Smalltalk allows you to change a class definition, and have that change propagate to existing instances.) Hybrid languages, like Ada, C++, and Modula-2 require you to overload the operator for each class or type. Can you spell "maintenance headache"? <...I think that if you required explicit marking by the programmer that this identifier would have a variable binding (perhaps even stating the set of possible values that it could take) then you'd be onto a winner... Static binding is best in all cases except for its usefulness in inheritance...> It's not really useful with inheritance if the language employs "copy down" as opposed to "look up" inheritance. Where it is useful is in combination with true message passing, when it can implement polymorphism. :::::: Software Productivity Technologies -- Experiment Manager Project :::::: :::::: Jan Steinman N7JDB Box 500, MS 50-383 (w)503/627-5881 :::::: :::::: jans@tekcrl.TEK.COM Beaverton, OR 97077 (h)503/657-7703 ::::::