Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: Scalars, Lists, and Arrays (run time)

by ysth (Canon)
on Feb 09, 2010 at 03:30 UTC ( #822125=note: print w/replies, xml ) Need Help??


in reply to Re^2: Scalars, Lists, and Arrays (run time)
in thread Scalars, Lists, and Arrays

Any contextual effects happening at compile time would be optimizations requiring extra code so I'm not surprised that I couldn't find any cases of that. It would also require some static analysis of the parsed code to even determine if the context can be known at compile time. This type of static analysis is pretty rare in perl.
But that analysis is exactly what happens - the syntax tree is descended and every operation applies context (or doesn't) to its operands, marking then as having list, scalar, or void context as determined by the operation. Then anything left unmarked gets context from the call stack at runtime.
--
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
Online Fortune Cookie Search
Office Space merchandise
  • Comment on Re^3: Scalars, Lists, and Arrays (run time)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://822125]
help
Chatterbox?
[Corion]: I wait for the day when DateTime uses Moose ;)
[TCLion]: finaly finished the install wow that was over 10 min
[1nickt]: Corion using Moose will hardly reduce the number of dependencies or time to install DT !
[davido]: That's like wishing that your motorcycle came with a sherman tank as a trailer.
[Corion]: davido: No, more like my one sherman tank had a second sherman tank tied to its back ;)

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-03-23 15:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (289 votes). Check out past polls.