develooper Front page | perl.perl6.internals | Postings from October 2002

[perl #18170] [PATCH] very complete lexical scope implementation

Thread Next
Jonathan Sillito
October 30, 2002 17:10
[perl #18170] [PATCH] very complete lexical scope implementation
Message ID:
# New Ticket Created by  Jonathan Sillito 
# Please include the string:  [perl #18170]
# in the subject line of all future correspondence about this issue. 
# <URL: >

The attached patch implements a very complete set of lexical scope
semantics. For those that have been following along, here are some

- supports (fast) access by lexical position, rather than just by name

- adds a couple more ops and some variations, including push_pad and

- adds a couple of keyed vtable functions for Scratchpad PMCs, so the
following work in a similar way to the various flavours of find_lex and
store_lex. The difference is that the find_lex and store_lex ops work
implicitly on the current pad, while these let you explicitly specify a pad

   new_pad P20, 0        # does not push on stack
   set P20[0;"foo"], P0  # like: store_lex Ix, Sy, Pz
   set P20[0;0], P0      # like: store_lex Ix, Iy, Pz
   set P20["foo"], P0    # like: store_lex Sx, Py
   set P20[0], P0        # like: store_lex Ix, Py
   set P3, P20[0;"foo"]  # like: find_lex Px, Iy, Sz
   set P3, P20[0;0]      # like: find_lex Px, Iy, Iz
   set P4, P20["foo"]    # like: find_lex Px, Sy
   set P4, P20[0]        # like: find_lex Px, Iy

- not based on PerlHash

Files affected by patch:

 - added: classes/scratchpad.pmc
 - added: t/pmc/scratchpad.t
 - changed: sub.c
 - changed: include/parrot/sub.h
 - changed: core.ops
 - changed: t/op/lexicals.t

Jonathan Sillito

-- attachment  1 ------------------------------------------------------

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About