On 12/9/2015 1:41 PM, Alexis King wrote:
> On Dec 6, 2015, at 10:03 PM, George Neuner <gneun...@comcast.net> wrote:
>
> I would disagree that multiple dispatch isn't needed.  The Visitor pattern is 
used fairly frequently in real programs and it is just a overly complex, 
error-prone way of doing double dispatch.  Trying to handle more than 2 dimensions 
of dispatch using Visitor involves considerable pain.
>

My understanding of the “vistor pattern” is that it’s just a way to emulate 
double dispatch in a single dispatch system, so I’m not sure that’s much of a 
use case. That said, I get the obvious advantages to multiple dispatch for 
modeling certain classes of problems. It would be nice to support multimethods, 
but I don’t think it’s currently clear how to implement multiple dispatch while 
maintaining the guarantees that racket/generic has been carefully designed to 
ensure.

I agree re: Visitor. My first point was that Visitor is used extensively - proof that the need for multiple dispatch is quite common. My other point was that Visitor doesn't scale easily to handle dispatch on more than 2 arguments.


> On Dec 7, 2015, at 9:56 AM, brendan <bren...@cannells.com> wrote:
>
> Does the current implementation use caching? The ideal (I think) would be to 
do a whole-program transformation that collects all the interface implementations. 
I'm not sure if Racket even has a mechanism for that, though. Even a per-module 
system would be handy, though, and that should be doable.

I’m unclear on what you’re specifically referring to here when discussing 
caching, and by extension, I’m not sure what question you’re asking. It sounds 
like an interesting topic, though, so I’d be curious to hear some clarification.

I *think* Brendan is referring to caching the dispatch path - i.e. once you've determined the proper function to call for a set of arguments, you cache the arguments (or their relevant characteristics) and the resulting function, so if you see them again you don't need to go through the whole dispatch process.

I've heard of this only as a research question - I've never encountered any language implementation that actually did it.


George

--
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to