develooper Front page | perl.perl5.porters | Postings from March 2001

Re: Distributive -> and indirect slices

Thread Previous | Thread Next
From:
Simon Cozens
Date:
March 19, 2001 07:51
Subject:
Re: Distributive -> and indirect slices
Message ID:
20010319151850.A27455@netthink.co.uk
On Fri, Mar 16, 2001 at 03:18:21PM -0600, David M. Lloyd wrote:
>     # Call $x->foo(); and $y->foo(); instead of
>     # current, less-useful $y->foo();
>     ($x, $y)->foo();
 
For what it's worth, I think this idea is great, although it's obviously not
going to happen in Perl 5. But then, I'd also like to see a generically
overloadable ->, of course.

> Or this, to get really nuts:
> 
>     # foo() is called in list context...
>     @structure->[2,0,3,1]->{'keyA', 'keyB', 'keyC'}->foo();

That's not really nuts. Really nuts would be suggesting that all operators
should distribute:

    @a = ($foo, $bar) . $baz     # @a = map { $_.$baz } ($foo, $baz)

Mmmm. I could get to like that.

-- 
Calm down, it's *only* ones and zeroes.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About