On Fri, Oct 20, 2006 at 12:23:57PM +0100, Rob Dixon wrote:

> Paul Johnson wrote:
> >
> >On Fri, Oct 20, 2006 at 10:56:09AM +0200, Dr.Ruud wrote:
> >
> >>Norbert Preining schreef:
> >>>
> >>>Dr.Ruud:
> >>>>
> >>>>$ perl -wle '
> >>>>  $a = 3;
> >>>>  $b = 0 + (++$a) + ($a++);
> >>>>  print "b=$b\n";
> >>>>'
> >>>>b=8
> >>>>:)
> >>>Nup, this is not the solution:
> >>Solution? 
> >>
> >>It showed that there is a bug. I already reported it. 
> >
> >And I already replied ENOTABUG as promised ;-)
> 
> It's clear what the language should be doing in this situation and it
> isn't doing it, so it's broken. It's only not a bug in the sense that
> it's documented to be broken.

I suppose this depends on whether you fall into the C camp or the Java
camp on this one.  (Substitute your favourite language that either does
or does not define an order of evaluation.)

The primary reason that C and Perl leave this behaviour undefined is
for implementation efficiency.  Now you may well cry that this reason is
bogus, as did the creators of Java, but it is so engrained in the
implementations of those languages that I don't think you are going to
have much luck trying to change it.  You're welcome to try, of course,
if you are getting fed up of all those demons flying out of your nose.

To compensate for this perceived disadvantage you get the advantage that
you will need to make your code simpler and easier to understand ;-)

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to