On Sat, Jul 02, 2005 at 03:45:45PM +0200, Leopold Toetsch wrote:
> Patrick R. Michaud wrote:
> >The following PIR code produces "NCI" as the output on my system:
> >    $ cat lower.pir
> >    .sub main @MAIN
> >        $P0 = find_name "lower"
> >        $S0 = typeof $P0
> >        print $S0
> >        print "\n"
> >    .end
> 
> Yep. "lower" is one of the names defined in src/builtin.c, which is 
> searched last for by the C<find_name> opcode.

Okay, that explains it.  This tells me that I probably need
to have PGE use separate find_lex and find_global ops instead of
find_name, but for a couple of other reasons PGE should probably be 
doing it this way anyway.

FWIW, I should note that none of the Parrot docs currently seem to 
describe the "builtin namespace" -- it's mentioned in the documentation 
for the find_name opcode but seemingly nowhere else.  I didn't understand
it until this last message.  I'll be glad to submit a documentation
patch to try to explain it -- even if only to add "XXX: we need to describe
the builtin namespace" -- but I'm not quite sure where it should go.

Pm

P.S.:  For those who are curious, the way PGE was using find_name
was causing "lower" in the builtin namespace to hide the entry for
the <lower> subrule in PGE::Rule.  Having PGE break this out into 
separate find_lex and find_global calls will probably fix this 
(as well as some other potential scope issues).  Coming soon.


Reply via email to