With mst's help, Method::Signatures can now handle attributes!
method echo($arg) : Whatever {
return $arg;
}
There are some edge cases which will screw up the parsing, see below.
In other news, mst suggested this new syntax.
method $foo($arg) {
return $arg;
}
be equivalent to:
*$foo = method($arg) {
return $arg;
}
which is clever and cuts out a lot of the "no strict" dance. Thoughts?
For attribute parsing, currently it just looks for the last { on the
"line" but the definition of "line" is hazy.
So while this works:
method echo($arg) : Whatever
{
return $arg;
}
And so does this:
method echo($arg) : Whatever({ foo => 23 }) {
return $arg;
}
This does not:
method echo($arg) : Whatever { return {} }
I need to work on a better parser. Fortunately there might be a way to do with without having to completely parse Perl.
thanks (Score:1)
Re: (Score:2)
Thanks. The plan is to prototype it out in Method::Signatures and then implement it in 5.12.
Re: Devel::Declare in 5.12 (Score:1)
You mean, there are already plans to fold the Devel::Declare magic into 5.12. At least supporting subroutine signatures would be great.
Re: (Score:2)
I mean put in a real method keyword and function signatures straight into the language. No screwing around with tokenizer hacks.
And by "the plan" I mean "my plan". rgs might have something to say about it. :)
Re: (Score:1)
I frankly get more excited about this kind of evolution that the full Perl 6 upgrade, which I expect will take years longer before I can use it for real work with reasonable performance.
Thanks for the clarification!