Reputation: 2483
I made a typo calling a method with the colon syntax. I missed the space after the colon and the second colon for the named parameter. I've replicated my problem with a simple class:
class Test {
method myMethod {
say "myMethod";
say %_;
}
}
Test.new.myMethod:test<this>; #mistyped call
Test.new.myMethod: :test<this>; #actual call
#Test.new.myMethod:"some_string";
The output is:
myMethod
{}
myMethod
{test => this}
What does the syntax of the first call mean and why is it not an error? Cheers
Upvotes: 7
Views: 135
Reputation: 32404
Identifiers of the form foo:bar
, foo:<baz>
, foo:quux<waldo>
, foo:quux<waldo>:abc<def>
etc. are extended identifiers.
The symbol's longname is aliased to its shortname, the first component of the identifier, so in this case myMethod:test<this>
is aliased to myMethod
.
Upvotes: 8