On Wednesday, December 11, 2002, at 05:39 PM, Simon Cozens wrote:
Welllll... yes and no. You can make the same argument for operators upon scalars, for example, since 'scalar' is arguably no more universal than 'array'. And we could easily use that argument to remove *all* builtins, period:[EMAIL PROTECTED] (Michael Lazzaro) writes:would be a false savings. If a method _is_ universal, especially if it's symmetric, it might be an OK candidate for a builtin or operator. And if it isn't universal, I can see (almost) no justification for wasting an op on it, no matter how common it is.Bingo. And things like "purge" only apply to arrays and lists, hence...
print $i; # ILLEGAL; use $STDOUT.print($i) or $i.print (?)
reverse @a; # ILLEGAL; use @a.reverse;
map {...} @a; # ILLEGAL; use @a.map({...});
sort {...} @a; #
keys %h; # ...etc...
in which case right-to-left pipes go away entirely, if we want them to.
But if we decide to allow _some_ array-based builtins (or even if we just make them all methods of Array and Hash) then deciding _which_ ones to include falls under the YMMV argument -- we have to guess. So purge or C<part> is valid to at least *consider* for inclusion.
My point was that in lang design it's possible to make a convincing but purely philosophical argument for or against anything (postmodernism?), and as such it will never be possible to declare hard-and-fast rules for what should or should not be a builtin. We just have to fight it out on a case-by-case basis.
MikeL