
www.Usenet.com
| <-- __Chronological__ --> | <-- __Thread__ --> |
In article <[EMAIL PROTECTED]>, Andreas Bogk <[EMAIL PROTECTED]> wrote: > I came up with this example trying to explain the difference between > function overloading in C++ and multiple dispatch in Dylan. More than once, people have asked me "in what way is Dylan dynamic"? Considering Dylan isn't as entirely dynamic and reflexive as, say, Smalltalk or Lisp, this can lead some to wonder what else is there to "dynamism". I think those C++ and Dylan code snippets also help illustrate this point. Of course, you might argue these are simply different programs that do different things, stemming from different language definitions, but the point is that the C++ code could be considered misleading, and some might argue the Dylan behavior makes more sense, or at least makes it easier to read and write code correctly. The "problem" with the C++ code is that "x * x" uses the dynamic type of x on the left-hand-side, but the static type on the right-hand-side. In Dylan, the dynamic type is used for both arguments?. This partly explains what we mean when we say that Dylan is "dynamic"--that the exact types of objects are used to determine behavior rather than being limited to an approximation by static semantics??. ?This is also partly due to Dylan being a "multiple dispatch" language, where the types of all the arguments are used to perform method dispatching rather than just the first argument as in some languages (the "this" or "receiver" argument). But this works in concert with dynamic typing to produce an overall dynamic behavior. ??Perhaps this inexactness is a problem specific to C++ and not static typing in general. -- Chris Page - Software Wrangler - Palm, Inc. That's "Chris" with a silent *and* invisible "3".
| <-- __Chronological__ --> | <-- __Thread__ --> |