Err, wait, I don't think we are discussing whether $_ is to be outlawed
in map {}. I think the proposal is for .method always mean $invocant.method
and make it illegal when there is no invocants in sight, mush as $.attr
would be illegal without an invocant.  To use $_.foo, write $_.foo.

Luke is discussing flow-on effects, just as larry was with his 'o' and 'c'.

if ( .process is $_.process ) {
        either {
                Specify an explicit invocant <--- Larry
        } or {
                Specify an explicit topical variable <--- Luke's musing
        }
} else {
        Call methods on $_ using $_.method <--- My preference still :)
}

The only thing that worries me about "The OC" idea (how curious that a feature is so easily named after a TV show) is that he is talking about them being functions. I don't know enough about interals, but would that get optimised to something faster, or do we suffer a second function call every time we want to call a method?

I also have some worries about there being three different ways to call a simple invocant method.

.method
$_.method   (except in map/grep)
o.method

It has a faintly similar smell to the workaround-hell mod_perl 2 got into... I'm all for TMTOWDTI, but surely the language should be elegant enough that something as simple as calling a not-special-in-any-way method doesn't need to have three different ways to do it?

An interesting exercise for anyone with a minicpan checkout would be to scan CPAN and see how often the various uses are needed currently. ($self-> compared to $_->).

Granted there are a hell of a lot of caveats in that, but it there's a 10 to 1 ratio of one to the other, surely that would help to make the prefered preference a little clearer?

Adam K

Reply via email to