On Monday, 25 August 2014 at 00:42:41 UTC, Idan Arye wrote:
Speaking of library solutions, I checked with my `castSwitch` PR and it managed to implement single-argument multi-dispatch:

https://github.com/D-Programming-Language/phobos/pull/1266#issuecomment-53217374

I'll try to get it to support multiple arguments(shouldn't be that hard) and then all we'll need is a simple wrapper to have our very own library implemented single dispatch.

I'm thinking we'll want two versions - a regular templated function like in Vladimir's reply, and also a template mixin that can take a bunch of methods with the same name(or annotated with a UDA) and create a multi-method of them.

These wrappers will be another PR, but they can be based on `castSwitch` for it's somewhat-optimized type-comparison implementation.

Damn, that is really nice! I was wondering when we'd see
something like this make its way into the standard library. :)

Reply via email to