Trygve Reenskaug mailto: try...@ifi.uio.no
Morgedalsvn. 5A http://folk.uio.no/trygver/
N-0378 Oslo Tel: (+47) 22 49 57 27
Norway
Just one thing to keep in mind when reasoning about these things: make sure that none of the strategies short-circuit the kind of JIT tricks that came into Smalltalk largely from self. I'm not enough of an expert to reason about these off the top of my head, but someone who crawls around inside VMs should know this stuff.
Maybe the contextualization of DCI makes it possible to do even more with JIT tricks and trust-until-misled bindings.
Second, it's not clear that this solution solves the name collision problem. It only adopts one disambiguation convention. I think that most of the mechanisms in use by other languages already adapt this convention or that to remove the problem. C++ is an exception in this regard, and you can get a real ambiguity. Sweet thing #1 is that the compiler tells you about it. Sweet thing #2 is that you can always use qualification resolution to manually disambiguate the call. The mechanism described in the mail selects the role method over the class method, which may not be what the programmer wants all the time. This will be especially devastating if it results in a violation of self-encapsulation: i.e., if the sender and receiver are the same object, and the sender expects the class method rather than the role method to be invoked.
I trust that you mean to invoke the method from the external function.
My answer to your question would be: No, particularly if looking at
this from the perspective of a language lacking full reflection.
Change that and my answer may be different.
Why and how would the capabilities of language impact the concepts of DCI?
> In the terms that Trygve and I developed during our last meeting, this is violating the abstraction layer.
So a language that supports reflection but makes invocation of
RoleMethods outside the implementing context even through reflection
is in accordance with the ideas of DCI right?
-Rune
Rune,
Please look at http://fulloo.info/t-files/BB7DijkstraNoInjection.pdf.
See the method BB7CalculateShortestPathCTX::send: selector to: roleName withArguments: argArray.
This fix leads to what I consider clean DCI behavior. An Interaction is triggered by a message to its Context. The Interaction does its work, and then exits. There are no spurious traces left from the Interaction. In particular, there is no added object behavior anywhere. My particular mechanism is irrelevant. It is a proof of concept, no more. Other implementations can fake it and make various compromises. I would consider it a flaw if an implementation adds functionality that is not part of clean DCI. (An example could be using role methods outside their Context).
The concept of DCI should not depend on implementation language. The fact that something can be done doesn't mean that we want to do it.
--Trygve
On 2011.10.23 14:39, Rune Funch Søltoft wrote: