jerry gay <[EMAIL PROTECTED]> wrote:
audreyt++ pointed out on #parrot that there doesn't seem to be a way to specify where to start finding lexicals, in support of perl's OUTER::. eg. (from S04):my $x = $OUTER::x; or my $x = OUTER::<$x>; i propose this should be specified using a three-arg form of find_lex <find_lex_p_s_i> where the third parameter is an integer specifying which level in the lexical chain to start the lookup.
While you can't do this with find_lex currently, you *can* do it. Tcl walks the lexpads to find lexicals. (See languages/tcl/runtime/variables.pir): .sub find_lex_pdd20 .param string variable_name .local pmc interp, lexpad, variable .local int depth interp = getinterp depth = 2 # we know it's not us or our direct caller. get_lexpad: # Is there a lexpad at this depth? lexpad = interp["lexpad";depth] unless_null lexpad, got_lexpad # try again inc depth goto get_lexpad got_lexpad: variable = lexpad[variable_name] .return(variable) .end Of course, that doesn't mean that I wouldn't like an opcode to do it for me. :-) -- matt diephouse http://matt.diephouse.com
