> 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.
> 
> Obviously CLOS combines multiple dispatch with latent typing, so that is one 
> place to look for solutions.  How to do it most efficiently is a fair 
> question.  Various Lisps have used tables and sorting trees for multimethod 
> dispatch.  I think most implementations have settled on using tables now, but 
> my understanding is that this was more to reduce compiler complexity than a 
> determination that tables are more efficient in most cases.
> 
> It is true that dispatch on 3 or more arguments is rarely needed - I read 
> somewhere that in Lisp, dispatch on 2 arguments accounts for 95+% of all 
> multimethod use.  But when it is needed, faking it on top of single dispatch 
> is a royal PITA.

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.

> 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.

-- 
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