Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^5: the '..' operator and decreasing values

by lidden (Curate)
on Mar 05, 2005 at 02:13 UTC ( [id://436833]=note: print w/replies, xml ) Need Help??


in reply to Re^4: the '..' operator and decreasing values
in thread the '..' operator and decreasing values

It seems perl586delta fooled lots of us. I did som testing and it turns out that reverse 0..100 will turn 0..100 to a list of 101 elements and traverse that list from the end.
for ( reverse 0 .. 100_000_000) {};
Wants to grab lots of memory and gets killed by my OS, without reverse it works nicely. Tried with perl5.8.6 and perl5.9.1.

Replies are listed 'Best First'.
Re^6: the '..' operator and decreasing values
by doom (Deacon) on Mar 06, 2005 at 00:28 UTC
    And you guys are reporting this bug to perl5-porters, right?
      There's no bug. As of 5.8.6 (or maybe 5.8.5, didn't check that) the reverse is indeed optimized away. However, the .. operator is still evaluated to produce the full list (at compile time). So there's a potential for optimizing that away also, but you can't actually call it a bug.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://436833]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-19 04:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found