On Tue, Jul 8, 2014 at 8:32 PM, Jonathan S. Shapiro <[email protected]> wrote: > On Tue, Jul 8, 2014 at 2:24 PM, Matt Oliveri <[email protected]> wrote: >> - There is no notion of "virtual" because there's no class hierarchy. > > Not quite. There is no notion of virtual because methods can't be overridden > in the way that C++/Java/C# do so.
Well, OK. And there isn't overriding because there's no inheritance of methods to override, which is essentially what I meant. I think I get half credit. >> - However, interface methods are dynamically dispatched to whatever >> implementation is provided by an element of the type. (Via a vTable >> pointer.) > > I'm not sure what you mean by "dynamically dispatched". The vTable is a > detail of implementation. The important question is: what is the difference > between this and invoking a field that has procedure type. The answer is > that the call is hijacked and rewritten such that the receiver gets the > existential datum. Good point. I guess what I meant is they're not like C++'s non-virtual methods, which don't have dynamic dispatch in any sense. >> - Functions that should not dynamically dispatch should not be >> interface methods. > > I don't think of this as dynamic dispatch. Dynamic dispatch > involves some form of computed method lookup whose result is > context-dependent in some way. That isn't going on here. Umm, well whatever you call it, the meaning of method calls is provided by instances of the interface, which may not be what you want in a given situation. _______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
