Thomas Sandlaà writes: > Luke Palmer wrote: > >But we always have enough knowledge to optimize the hell out of this, > >and they're not not handwavy "we can probably" optimizations. They're > >real, and they're pretty darn easy. > > I fully agree. But I like to add that a single 'where' on general > types like Int, Str or even Any can seriously harm performance because > than the dispatcher has to check it always and everywhere! So the > Perl 6 type system let's you have your rope and tie yourself. Well, > that is late binding :)
Only if you define an AUTOLOAD on your subtypes. The way to think about multimethod implementation problems is inside-out from how you think about single dispatch. The *method* is the one that knows everything, not the object. So definitions on subtypes of general types only check for those subtypes when dispatching to the methods defined in them. Luke