On Sat Aug 15 14:04:44 2009, masak wrote:
> <jnthn> rakudo: class A { has $.foo; method new($foo) {
> nextwith(:$foo) } }; say A.new("OH HAI").foo
> <p6eval> rakudo 0d4fe0: OUTPUT«too many named arguments - 'foo' not
> expectedin method A::new
> <masak> jnthn: should that have worked?
> <jnthn> Hmm
> <jnthn> rakudo: class A { has $.foo; method new($foo) { say "ok" } };
> say A.new("OH HAI")
> <p6eval> rakudo 0d4fe0: OUTPUT«ok1»
> <jnthn> I think so. I'm not quite sure what it tried to call. :-/
> * masak submits rakudobug
> <jnthn> rakudo: class A { has $.foo; method new($foo) { callwith($foo)
> } }; say A.new("OH HAI").foo
> <p6eval> rakudo 0d4fe0: OUTPUT«Method 'foo' not found for invocant of
> class 'Str'»
> <jnthn> Oh! :-/
> <masak> seems to be something to do with the invocant...
> <jnthn> Well
> <jnthn> Kinda.
> <jnthn> Hmm. I'm not sure off-hand why that doesn't work.
> <masak> but it should, so it goes on the RT pile.
> <jnthn> One of the annoyances of implementing callwith and nextwith is
> that in the case of them being used to defer to another method, they
> need to find and pass on the invocant.
> <jnthn> Whereas in the case of a wrap, they maybe don't.
> <masak> ah. tricky.
> <jnthn> Yeah.
> <jnthn> It'd not surprise me if we have bugs there.
Is this the desired behavior?
09:39 < [Coke]> rakudo: class A { has $.foo; method new($foo)
{nextwith(:$foo)
} }; say A.new("OH HAI").foo
09:39 <+p6eval> rakudo 142c41: OUTPUT«OH HAI»
09:39 < [Coke]> rakudo: class A { has $.foo; method new($foo) { say "ok"
} };
say A.new("OH HAI")
09:39 <+p6eval> rakudo 142c41: OUTPUT«okBool::True»
09:39 < [Coke]> rakudo: class A { has $.foo; method new($foo) {
callwith($foo)
} }; say A.new("OH HAI").foo
09:39 <+p6eval> rakudo 142c41: OUTPUT«Default constructor only takes
named
arguments in method new at src/gen/CORE.setting:516
in
<anon> at src/gen/Metamodel.pm:2375 in call_with_args
at
src/gen/Metamodel.pm:2372 in method new at
/tmp/WW9uUIODIh:1
in block <anon> at /tmp/WW9uUIODIh:1 in <an…
--
Will "Coke" Coleda