Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Does @{ } copy arrays?

by QM (Vicar)
on Oct 17, 2009 at 01:06 UTC ( #801691=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Does @{ } copy arrays?
in thread Does @{ } copy arrays?

Well, wouldn't $#{}, and @{} in a scalar context need similar magic? Isn't the second just an increment of the first? (There must be more magic anticipated by $#{} to warrant the slowdown?)

-QM
--
Quantum Mechanics: The dreams stuff is made of


Comment on Re^3: Does @{ } copy arrays?
Select or Download Code
Re^4: Does @{ } copy arrays?
by dave_the_m (Parson) on Oct 17, 2009 at 10:57 UTC
    @a in scalar context just pushes its size onto the stack. $#a in scalar context could be an lvalue or an rvalue, so a 'magic' var is pushed onto the stack that updates the array's size if assigned to. This could probably be optimised when pp_av2arylen is called in rvalue context.

    Dave.

      Ah, of course. I suppose there are cases where it's not immediately apparent to the parser if a given occurrence is an lvalue or rvalue?

      -QM
      --
      Quantum Mechanics: The dreams stuff is made of

      This could probably be optimised when pp_av2arylen is called in rvalue context.

      Done by commits 02d85cc37a4acecafdc2f0b45640b03cd1f4ac71 and 28c5b5bcd7f52e6b2219508a1066cd0ccc8dd19a. You'll see these changes in 5.11.2 (next month's dev release) and 5.12 (early to mid 2010)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-04-19 10:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (480 votes), past polls