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

Re: Distributive -> and indirect slices

Thread Previous | Thread Next
David M. Lloyd
March 19, 2001 07:48
Re: Distributive -> and indirect slices
Message ID:
On Mon, 19 Mar 2001 wrote:

> > My thinking was that not too many people use the current
> > behaviour... maybe for Obfuscated Perl contests, but the operator could be
> > so much more powerful than it is right now.
> Eh, don't forget it also provides scalar context to 'method' in:
>     $obj -> method -> other_method;
> I don't think methods returning objects in scalar context and lists
> in list context are obfuscated. That's what's wantarray is about, isn't?

That behaviour wouldn't change, since the leftmost expression is a scalar.

If however you did this:


The first method 'method' would be called in list context on '$obj', and
'other_method' would also be called in list context, once for every object
in the return list of 'method', raising the normal error if one of the
items returned is not an object that can 'other_method'.

The 'obfuscated' behaviour I was referring to was that of having an
explicit list or array on the left-hand side of the operator.

- D


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About