Re: [perl #60554] BUG: 'our' variables getting lost in NQP actions
[email protected] (Bernhard Schmalhofer)
| Newsgroups | perl.perl6.internals |
|---|---|
| Message-ID | <[email protected]> |
Patrick R. Michaud via RT schrieb:
> On Sat, Nov 15, 2008 at 11:46:01AM -0800, Bernhard Schmalhofer wrote:
>
>> In Pipp I encountered the problem that an our variables seem to get
>> lost in NQP actions.
>> This means that I had set an our variable in one action. When trying to
>> look at the
>> variable in a subsequently called action, the variable was not defined.
>> However this was not reproducible. Using the variable in another action
>> worked as expected.
>>
>> In t/compilers/pct/complete_workflow.t:84 I added a TODO test case that
>> illustrates this
>> behavior.
>>
>
> The test case appears to have incorrect logic.
>
> $?MY_OUR_VAR appears to be set by the action method for TOP, but the
> action method for thingy will be called _before_ the action method
> for TOP. Thus it's pretty clear that thingy won't see the setting
> of $?MY_OUR_VAR because it hasn't occurred yet.
>
> Pm
>
>
>
I think that I misunderstood how actions work.
I thought that the action for <thingy> is called by the line:
make $( $<thingy> );
But is looks like it is called during the matching process, which make
perfect sense.
So my real problem is:
In the action for <thingy> how do I determine that the match is
below <TOP>?
I need this for distinguishing between function scope and global scope
of variables in PHP.
Regards,
Bernhard