Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^4: No garbage collection for my-variables

by betterworld (Deacon)
on Sep 16, 2008 at 22:35 UTC ( #711816=note: print w/ replies, xml ) Need Help??


in reply to Re^3: No garbage collection for my-variables
in thread No garbage collection for my-variables

It's the same mechanism that sort uses for in-place sorting in 5.10. I've thought about patching List::Util::shuffle() in the same way.

I thought what you meant was that a subroutine can detect its being called in void context? But if I am not mistaken, 5.10's in-place sorting does not happen in void context:

% perl5.10.0 -lwe '@a = (2,1); sort @a; print @a' Useless use of sort in void context at -e line 1. 21

As I understand it, perl (5.10) will detect that in @a = sort @a, the destination array is the same as the source array, so it uses a more efficient algorithm (but it's still in list context).


Comment on Re^4: No garbage collection for my-variables
Select or Download Code
Replies are listed 'Best First'.
Re^5: No garbage collection for my-variables
by BrowserUk (Pope) on Sep 17, 2008 at 00:08 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2015-07-29 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls