[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: the forward method [dynamic vs. static typing]
At 8:21 PM -0800 12/9/03, Chris Page wrote:
>On Dec 9, 2003, at 19:20, Ken Shan wrote:
>>On 2003-12-09T18:16:51-0800, Chris Page wrote:
>>>I don't see what this has to do with static or dynamic typing. It
>>>has more to do with whether or not your language allows for some
>>>type of polymorphism so you can use the same function/message
>>>name, which is an orthogonal concern. Dylan, Lisp, Smalltalk and
>>>C++ all allow for this.
>>I don't know of any language said to be dynamically typed that
>>allows for dispatch based on return type; do you?
>Dylan, Lisp, Smalltalk and C++. In the sense that a compiler can
>look at the return type of a function A and use that to dispatch a
>subsequent call to function B (when you pass the result of A to B).
This isn't what he's talking about. Using the return type as part of
dispatching means that:
i = foo();
j = foo();
may call different versions of foo, if foo dispatches based on return
type as well as (its nontexsitent, in this case) parameters.
There are a number of ambiguities in some cases that make it
difficult to deal with. For example, if you have these definitions:
which foo gets called for:
? You could go either way. Or both ways if you want to implicitly
fire off multiple threads in that case (you could make the result a
quantum superposition of the calls and see which one it collapses to
first, but I'd bet the maintenance programmer'd be the first to
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
firstname.lastname@example.org have teddy bears and even
teddy bears get drunk