ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl6-language
perl6-language
Optimisations (was Re: How much do we close over?)
by Paul Johnson other posts by this author
Jun 13 2005 5:38AM messages near this date
Re: How much do we close over? | Re: Optimisations (was Re: How much do we close over?)
On Mon, Jun 13, 2005 at 11:24:07AM +0000, Luke Palmer wrote:

>  I just have to say that it's really annoying running into
>  optimizations when I don't want them.

Isn't the whole point of optimisations that you shouldn't have to worry
about whether you hit one or not, otherwise the optimisation would seem
to be broken.

>                                         Back when I wrote an
>  back-chaining system in perl, I used tied variables in order to
>  determine when I needed to solve for something.  A standard idiom was:
>  
>      rule \$var, sub {
>          $a and $b and $c;
>          $var = 1;
>      };
>  
>  And damnit, $c would never be solved for, because it was optimized
>  away by Perl.

I'm not sure that short circuiting operators can be called an
optimisation.  Aren't they more part of the language definition?  I
assume Perl 6 isn't doing away with short circuiting operators.

>                 I ran into that problem rather quickly, and I knew a
>  "no optimizations" would do the trick, if it existed.  But no such
>  luck, so I always had to add an "and 1" on the end.  Funny thing is,
>  that should have been optimized away too, but it wasn't, because Perl
>  wasn't that good at optimizations.  So now I have to know about the
>  capabilities of the language I'm using in order to program.

I'm not sure about the premise, but I agree with the conclusion.

>  To sum up, optimizations are nice, and it's nice to have optimizations
>  on by default for PR reasons, but you have to be able to turn them
>  off.

One of the things that has been on the Perl 5 wishlist for a while is a
way to turn off the optimisations, but really that would only be for the
benefit of people and modules that mess with the op tree.  Again, I
submit that an optimisation that changes normal behaviour is broken and
that, in general, programmers shouldn't need to worry about what
optimisations are going on under the covers.

-- 
Paul Johnson - paul@[...].net
http://www.pjcj.net
Thread:
Luke Palmer
Paul Johnson
Luke Palmer

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved