On Thursday, December 12, 2002, at 01:11 PM, Michael Lazzaro wrote:
We can make thatWell, if the source file were considered to be just a big giant class, sans
@out = @in.grep({...}).map({...}).sort; # [2]
if we want to grind our OO axe, but I find that syntax disappointing. I like that the idea is important enough in Perl to have it's own grammar, but I realize the problem of namespace pollution involved in having a bunch of builtins called grep, map, whatever.
The only encompassing solution would seem to be to find a grammar rule by which map,grep,etc are unambiguously methods of Array, but can still be called in a fashion similar to [1]. That would, I suspect, satisfy everyone.
class main {
...
}
then it becomes as simple as having a method in Object, grep, something like:
class Object {
method grep($a_closure, *@input) {
...
}
}