On Sun, Jul 17, 2005 at 18:23:02 +0000, Luke Palmer wrote: > > * Coercion of parameters and a class's willingness to coerce > > into something is a better metric of distance > > Well, if you think metrics at all are a good way to do dispatch.
Well, we do have a notion of "closeness" already - that's what MMD is about - a more particular method is chosen over a less particular one. chromatic's idea is simply to make the way you determine particularity based on the class's desire to fulfill the class/role (a coercion distance), not on it's type hierarchy> > Well, I like your proposal. It's a very generics-oriented world view, > which I hold very dear. However, you didn't actually solve anything. Yes, I'm aiming to destroy ;-) > What happened to our numeric == and string eq. Are you proposing that > we toss out string eq and let MMD do the work? Yep. =) Come to think of it - I just needed to compare strings in perl 5 - i normally either match or use hashes as dispatch tables, so comparison doesn't happen often. I used '==' instead of 'eq'. > If I recall correctly the reason for == and eq existing and being > distinct is so that you don't have to do: > > [EMAIL PROTECTED]()+$expression] == +%another{long($hairy % expression()) > } > ^..................................^ > > You can't see what's going on according to that operator, because the > eye scanning distance is too great. We still need to satisfy the > scripters who like the distinction between numeric and string > comparison. It's hard for me to argue for them, since I'm not one of > them. Well, in that case doing an explicit MMD selection of == is in order - yet another reason for that feature. > One more possibility is operator adverbs. We could assume that == is > generic unless you give it a :num or :str adverb: > > $a == $b # generic > $a == $b :num # numeric > $a == $b :str # string yuck yuck yuck yuck yuck.... Now the one true version of == will be patched once a week to support new adverbs, and those patches will be promptly rejected, and there will be chaos. -- () Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker & /\ kung foo master: /methinks long and hard, and runs away: neeyah!!!
pgppGmijYrizj.pgp
Description: PGP signature