On Mon, Dec 16, 2002 at 08:26:25PM +0000, Piers Cawley wrote:
> Dave Storrs <[EMAIL PROTECTED]> writes:
> > On Mon, Dec 16, 2002 at 06:47:39PM +0000, Piers Cawley wrote:
> >> Michael Lazzaro <[EMAIL PROTECTED]> writes:
> I haven't been arguing against his syntax for adding L to R
> pipelines, but against the damage he proposes doing to R to L syntax.
Fair enough. I'd like to find a way for neither of them to go away,
or get damaged.
> > However, I think that L2R is valuable enough that it should make it
> > into the language, and I don't have a better suggestion.
>
> Well, L2R is really easy:
>
> @ary.map({...}).grep(rx/.../).whatever(...);
>
> For ugly values of 'really easy' of course.
Yick. I'll definitely agree on the "ugly" part.
However, I'm curious--and I know this has been hashed over, I'm just
not clear on where we stand at this point--are you proposing that map,
grep, and whatever would be methods on Array? Because that seems
unnecessarily restrictive. And yet, having them be methods of Object
seems a bit TOO generous.
Perhaps the answer is to have an inheritance tree that goes
Object
|
v
Collection
|
+-Array
|
+-Hash
|
+-etc (maybe Set, or maybe junction)
...and map, grep, etc, would be elements of Collection, overriden in
sensible ways by the derived classes?
This is an off-the-cuff idea and I may well be full of it.
--Dks