On Tue, Jan 16, 2007 at 01:41:30PM -0800, Jonathan Lang wrote: : Luke Palmer wrote: : >Seems reasonable. My generality alarm goes off when I realize that : >you can't specify commutativity for two of the three args, but that's : >fine because it's definitely a cpanable feature. : : IIRC, it's possible to embed one signature within another one; if the : embedded signature has two parameters and "is commutative" while the : embedding signature is not commutative and has a third arg, wouldn't : that produce commutativity for two out of the three, as long as : they're adjacent? : : >> Does the trait only apply within one region of the arglist, or can I : >> create a 1-arg method that is commutative between the "self" arg and its : >> data arg? (I assume not -- I can't quite work out what that would mean) : > : >That's CPAN's job, I think. : : IMHO, "is commutative" should only apply to positional args: named : args have this behavior automatically, and trying to include the : invocant would tend to interfere with the self-contained nature of : classes and roles - that is, it would allow role A to define a method : for role B.
I've decided "is commutative" must die of ill-definedness. See instead the recent S13 change to support multiple signatures on a single body. This approach seems to be both more general and better defined. I like that, up to a point... Larry