On 6/15/05, Tassilo von Parseval <[EMAIL PROTECTED]> wrote:
> On Wed, Jun 15, 2005 at 01:30:12PM +0200 demerphq wrote:
> 
> > On 6/15/05, Tassilo von Parseval <[EMAIL PROTECTED]> wrote:
> > > so it's not that the current behaviour should be such a surprise to an
> > > experienced user. For me it's mostly an aesthetic question really. Do we
> > > want this couple:
> > >
> > >     print $x +$y;       # means: $x + $y
> > >     print { $x } +$y;
> > >
> > > or rather this one:
> > >
> > >     print $x +$y;       # means: print { $x } +$y;
> > >     print $x + $y;
> > >
> > > The second one is visually less offending. Futhermore, there is no
> > > style-guide I know of that suggests using a space before a binary
> > > operator but not after it. Perl should make such ugliness as hard to
> > > employ as possible.
> >
> > I'm with Schwern. The first one is the only logical scenario.
> >
> > print $x +$y; # should mean $x + $y always
> > print $x $y; # should mean print { $x } $y
> >
> > since the latter is legal and the recommended way to write to a
> > lexical filehandle making the former a synonym for it seriously
> > violates the principle of least surprise. Also taking this approach
> > the docs become correct again i think.
> 
> They are still incomplete then. From 'perldoc -f print':
> 
>    Note that if you're storing FILEHANDLES in an array or other
>    expression, you will have to use a block returning its value
>    instead:
> 
>        print { $files[$i] } "stuff\n";
>        print { $OK ? STDOUT : STDERR } "stuff\n";
> 
> Note how that implies that I can always use a simple scalar as
> filehandle without the need for a block.

Unless made explicit the implication you mean is not at all clear and obvious.
 
> Other than that, there is no logical scenario here. Unary plus and minus
> are legitimate operators in Perl. Assuming the user meant the binary
> counterparts is an entirely arbitrary decision. 

I don't agree at all. Having unary behaviour occur when binary
behaviour is a valid possibility is a bug. While it may be a bug we
have to accept I refuse to accept that this is an "entirely arbitrary
decision". That flys in the face of hundreds of years of accepted
mathematical practice.

If we are going to accept this bug then we need specifically document
it as it totally breaks reasonable expectation. And the inconsistancy
in it is IMO a big problem. Why should a space determine whether an
operator is binary or unary? And why should it only do so when
indirect notation is involved?

yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to