The honest answer to your question is that I don’t know (though I’d also be 
interested to hear the answer). Obviously, I’d like to see generic APIs given 
more thought, but they are currently somewhat slow due to how dispatch is 
performed. I don’t think that’s a reason to design APIs in a certain way, but 
it is a practical consideration. I’m guessing that can be optimized, though, 
and I’d be curious to see how generics fare on Pycket.

More generally, I’m not sure multiple dispatch is needed, though it can be a 
neat tool at times. I think part of the problem is that multiple dispatch is 
both hard to reason about and slow to implement in a dynamically-typed 
language. It’s unclear what to use to dispatch on given that values do not have 
“types”. Clojure has multimethods, which could certainly be ported to Racket, 
but it is of note that Clojure protocols are single dispatch and are much 
faster. This is arguably because they leverage features of the JVM rather than 
possessing an inherent speed difference, but that is a much larger discussion.

Generics are already used in a few places, such as Racket dicts, sets, and 
“sequences”, but I certainly think it would be nice if more functions were 
overloadable. At the same time, sometimes that can just be confusing rather 
than helpful. I think that collections are an obvious place where generic APIs 
just make sense, but I’d be open to hearing suggestions for other parts of 
Racket to be “genericized”.

> On Dec 6, 2015, at 10:49, brendan <bren...@cannells.com> wrote:
> 
> Great! As an aside, do you know if there are any plans to integrate generics 
> (or, ideally, multiple dispatch) more tightly in later versions of Racket?
> 
> -- 
> 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.

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