At 04:02 PM 8/16/00 +1000, Jeremy Howard wrote:
>Nathan Torkington wrote:
> > Your [Jeremy's] RFC says:
> > > Currently, operators applied to lists in a list context behave
> > > counter-intuitively:
> >
> > Counter-intuitively is different from consistently.  Your title is
> > misleading.  Perl's ops *are* applied consistently: they consistently
> > give their arguments scalar context (except for the short-circuiting
> > logops, which I'd like to fix by making them return the useful lists
> > instead of possibly a list or a scalar).
> >
>You're right. If RFC 45 is implemented they would however be inconsistent.

No, || is half-consistent at the moment: the left hand side is forced into 
scalar context but the result context propagates down the right hand 
side.  I challenge anyone to come up with a rationalization for this that 
does not invoke implementation expediency.

>Anyway, I'll change the title in the next version.
>
> > > The proposal to handle functions is tricky, since there is currently no
> > > obvious way to see whether a function is going to return a list. Either
>we
> > > need some kind of more advanced prototyping (or other way of creating a
> > > signature), or we need to manually change functions provided with Perl
>to
> > > check for list context and Do The Right Thing.
> >
> > I assume you're talking about:
> >
> >   @r = func1() + func2();
> >
>No, I'm talking about:
>
>   @r = abs(@r);

I know what you want that to do, and even though I haven't wanted to do 
that since I was writing a 3-D object manipulation program in PerlTk I can 
appreciate the elegance of it; but it just don't read right to me at first 
glance.

This is like trying to define obscenity: some ends of the spectrum are 
pretty clear:

   @a = @b * @c;

clearly reads as matrix multiplication.  This is a 1958 Playboy cover.

   @a = @b ? @c : @d;

Making *that* distributive would be something written on a bathroom wall at 
Venice beach.
In between we have

   @a = @b || @c;

which goes according to taste.  Mebbe a slightly cleaned-up version of 
Flesh Gordon (which has been airing on the Space Channel in Canada, but 
would never see the light of day on the equivalent cable tier in the US).

--
Peter Scott
Pacific Systems Design Technologies

Reply via email to