On Tue Nov 10 07:55:06 2015, pesc...@gmail.com wrote: > On Sat Feb 22 17:37:47 2014, coke wrote: > > On Fri Apr 16 01:31:22 2010, masak wrote: > > > <masak> rakudo: multi foo(Int $x is rw) { say "writable" }; multi > > > foo(Int $x) { "readonly" }; foo(42) > > > <p6eval> rakudo 78faa0: OUTPUT«Ambiguous dispatch to multi 'foo'. > > > Ambiguous candidates had signatures::(Int $x):(Int $x) [...] > > > * masak submits rakudobug > > > <masak> S06: "To allow modification, use the C<is rw> trait. This > > > requires a mutable object or container as an argument (or some kind > > > of > > > type object that can be converted to a mutable object, such as > > > might > > > be returned by an array or hash that knows how to autovivify new > > > elements). Otherwise the signature fails to bind, and this > > > candidate > > > routine cannot be considered for servicing this particular call. > > > (Other multi candidates, if any, may succeed if they don't require > > > C<rw> for this parameter.)" > > > <moritz_> now you're just showing off :-) > > > <masak> :P > > > > Behavior is mostly unchanged since 2010 - error message has better > > signature reporting, but still reported as ambiguous. > > > > 20:36 <[Coke]> m: multi foo(Int $x is rw) { say "writable" }; multi > > foo(Int $x) > > { "readonly" }; foo(42) > > 20:36 <camelia> rakudo-moar b2b333: OUTPUT«Ambiguous call to 'foo'; > > these > > signatures all match::(Int $x is rw):(Int $x) in > > sub foo at > > /tmp/CwM3ZkL1nu:1 in block at /tmp/CwM3ZkL1nu:1» > > With Rakudo commits 8cba8863 and ed10656c this now behaves as follow: > > 15:52 < psch> m: multi foo(Int $x is rw) { say "writable" }; multi > foo(Int $x) { "readonly" }; say foo(42); foo my $ = 42; > 15:52 <+camelia> rakudo-moar ed1065: OUTPUT«readonlywritable» > > I've also added S06-multi/by-trait.t to spectest.data which tests > this.
psch++ also updated most of the multi-dispatch caching logic to get things performing well again. Today I updated the dynamic optimizer in Moar to understand the new multi-dispatch flag, so we don't go mis-inlining. And fixed a further static optimizer issue where it wasn't aware of `is rw` and so could mis-dispatch. Both covered by more tests in S06-multi/by-trait.t. So, we can consider this done. /jnthn