mvgrimes / Perl-Tidy-Sweetened

Tweaks to Perl::Tidy to work with some of the "modern" method syntax
Other
7 stars 13 forks source link

Anonymous methods not recognized #4

Open chuckadams opened 10 years ago

chuckadams commented 10 years ago

I'd like to be able to use this with the anonymous method syntax of Method::Signatures or Function::Parameters, specifically something like this:

my $foo = { bar => 1, baz => method ($x,:$y) { $self->xyzzy($x,$y) } };

However, it looks like the current filters are pretty hostile to 'method' or 'func' being used without a name. I made a couple stabs at fixing this myself so I could submit a pull request instead of an issue, but got nowhere :(

mvgrimes commented 10 years ago

Thanks for the bug report. I'll see if I can add it, but I won't be able to get to it for several more weeks.

On Tue, Jul 15, 2014 at 7:48 PM, Chuck Adams notifications@github.com wrote:

I'd like to be able to use this with the anonymous method syntax of Method::Signatures or Function::Parameters, specifically something like this:

my $foo = { bar => 1, baz => method ($x,:$y) { $self->xyzzy($x,$y) } };

However, it looks like the current filters are pretty hostile to 'method' or 'func' being used without a name. I made a couple stabs at fixing this myself so I could submit a pull request instead of an issue, but got nowhere :(

Reply to this email directly or view it on GitHub https://github.com/mvgrimes/Perl-Tidy-Sweetened/issues/4.

mvgrimes commented 10 years ago

I've looked into this a bit. It certainly isn't going to be a quick fix. The anonymous method seems pretty unusual, but I certainly see where the anonymous func would be useful.

I'll look into this more when time permits. Of course, patches are always welcome.

srchulo commented 4 years ago

Hi, I was just wondering if there had been any progress on this? I would love to see this feature :)

For anyone else -- for now I just get around it by creating a non-anonymous method and then referencing it:

my $fun = \&my_fun;

fun my_fun () {
   ...
}