Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Why doesn't perl optimize this?

by nbtrap (Sexton)
on Jun 04, 2013 at 02:09 UTC ( #1036861=note: print w/replies, xml ) Need Help??


in reply to Re^2: Why doesn't perl optimize this?
in thread Why doesn't perl optimize this?

I know the difference. My question was not about the difference, it was about why the difference is not optimized away in cases like the one I cited.

Replies are listed 'Best First'.
Re^4: Why doesn't perl optimize this?
by LanX (Bishop) on Jun 04, 2013 at 10:29 UTC
    You seem to believe in magical powers of static code analysis in a dynamic language.

    plz tell me

    sub func { my ($code,@a) = @_; my $b = [@a]; eval $code; return $b; }

    How is the compiler supposed to know that '@a' can be destroyed w/o knowing what happens in '$code' at runtime?

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      I agree that the compiler can't know in the case you cite. But what about the case I cited?
        > But what about the case I cited?

        It's extremely complicated and risky to cover ALL edge cases. It's not worth it and BrowserUK already told you!

        If you think such code analysis is easy, please better try implementing a JIT compiler for Perl...

        Cheers Rolf

        ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1036861]
help
Chatterbox?
[jedikaiti]: Well, the Monastery is still standing, so the party wasn't that epic
[Discipulus]: ;=) I will unavailable this week during eu morning time: I'm following a redhat 7 basci course, finally
[1nickt]: bravo
[jedikaiti]: wheee
[Discipulus]: bravo the $employer who pay 1.340 neuros + vat ;=)
[Discipulus]: but i'd need 2 courses o acces the first lvl examen: they didnt pay it this year

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2017-12-11 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (308 votes). Check out past polls.

    Notices?