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

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

Thread Next
From:
Jonathan Sillito
Date:
October 30, 2002 17:10
Subject:
[perl #18170] [PATCH] very complete lexical scope implementation
Message ID:
rt-18170-40837.3.2106282094442@bugs6.perl.org
# New Ticket Created by  Jonathan Sillito 
# Please include the string:  [perl #18170]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=18170 >


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

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

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

- 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

Comments?
--
Jonathan Sillito


-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/40837/32924/c69a1d/lexical.tar


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About