On Mon, Jul 19, 2021 at 11:08 AM Matthew Flatt <mfl...@cs.utah.edu> wrote:

> Are there other useful variants that are not currently supported (at least
> directly)?
>

I think the answer to this is “no.” My reasoning follows.

>From the perspective of subclasses, superclass methods come in three sorts:
overridable, augmentable, and final. The existing method declaration
keywords support all possible transitions between these sorts, which
suggests the current set is complete. However, my original email shows that
compositions of these transitions can affect *dispatch* in different ways
from the existing keywords, even if they result in methods belonging to the
same sort.

This fundamentally hinges on the fact that overment has an unusually
significant impact on dispatch behavior. overment switches from
subclass-first dispatch to superclass-first dispatch, which means overment
followed by augride effectively breaks a chain of Java-style methods into
two sub-chains. In contrast, the other keywords provide no such utility:

   -

   override and augment on their own do not change dispatch characteristics
   at all from the perspective of other classes.
   -

   augride followed by overment creates a local chain of Java-style methods
   before switching back to Beta-style inheritance. Since this chain is wholly
   self-contained, it does not change the overall dispatch structure in any
   way, and it could be replaced by completely static dispatch with no loss of
   expressiveness.

The main interesting thing about overment followed by augride is that it
allows something reminiscent of the CLOS :around method combination, since
it allows a class to receive control on both the way down *and* the way up
through method dispatch. Since override already provides the “on the way
up” part, a hypothetical interface for this would make most sense as
something that could be present on its own *or in addition to* an ordinary
override declaration, like

    (define/override (m x)
      (super m x))
    (define/around (m x)
      (inner/around m x))

where inner/around is like inner, but it doesn’t take a default-expr, since
it always has a Java-style method to dispatch to. I don’t know if these
names are the best—around doesn’t really seem right to me—but I don’t know
what else to call it.

Alexis

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAA8dsadsniyVBv%3De2NGFEUgk3EGzNmzvBcsECw8xFgAizOSUiA%40mail.gmail.com.

Reply via email to