find_name doesn't obey docs on unbound

Jonathan Leto jaleto at gmail.com
Fri Feb 19 06:16:24 UTC 2010


Howdy,

I am talkign to Perry at PDX Hackathon, and the example code that does
not work should be:

    .include 'errors.pasm'
.sub main :main  ### :pedantic_args
       .param string argv :slurpy
       errorson .PARROT_ERRORS_GLOBALS_FLAG
       push_eh myhandler
       $P0 = find_name "i_better_not_exist_or_this_thing_is_crazy"
       pop_eh
       if null $P0 goto wasnull
       say "not null, must have existed somehow.   inconceivable!"
       exit 1
wasnull:
       say "was null.   not good!"
       exit 2
myhandler:
       pop_eh
       say "generated exception.   excellent!"
       exit 0
.end


Note that errors.pasm had to be included, errorson does not have
parens and a few pop_eh's need to be sprinkled in.

Duke


On Thu, Feb 18, 2010 at 8:47 PM, Jonathan Leto <jaleto at gmail.com> wrote:
> Howdy,
>
> It kind of looks like
>
> errorson(.PARROT_ERRORS_GLOBALS_FLAG)
>
> does nothing. There is no test coverage for this function with this
> argument. Has anybody ever used it successfully?
>
> Duke
>
>
>
> On Tue, Feb 16, 2010 at 12:27 PM, Perry Wagle <wagle at mac.com> wrote:
>> [Please do just poke at me until I make sense.]
>>
>> I tried to get it to work, asked questions on IRC until I looked at the sourcescp  and saw that the code didn't even try to generate the exception.  So, I deleted my attempts.
>>
>> Since then, I found several different ways to look through the namespaces, and thought picking on find_name wasn't even close to the real problem.
>>
>> That said, I tried to get this to run, just now:
>>
>> .sub main :main  ### :pedantic_args
>>        .param string argv :slurpy
>>        errorson(.PARROT_ERRORS_GLOBALS_FLAG)
>>        push_eh myhandler
>>        $P0 = find_name "i_better_not_exist_or_this_thing_is_crazy"
>>        if null $P0 goto wasnull
>>        say "not null, must have existed somehow.   inconceivable!"
>>        exit 1
>> wasnull:
>>        say "was null.   not good!"
>>        exit 2
>> myhandler:
>>        say "generated exception.   excellent!"
>>        exit 0
>> .end
>>
>> but the errorson command is unhappy for some reason.  I don't know when I can get back to this.
>>
>> -- Perry
>>
>>
>>
>>
>> On Feb 16, 2010, at 11:38 AM, Jonathan Leto wrote:
>>
>>> Howdy,
>>>
>>>> Hence, my judgement was that whoever went through and added all the (optional) error generation needed to write the tests, since they would know what had been decided about what all should do what when and where.
>>>
>>> *I* am offering to write tests. I want to know what you wrote and what
>>> it did. If it is undocumented, it needs tests.
>>>
>>> Duke
>>>
>>>
>>> --
>>> Jonathan "Duke" Leto
>>> jonathan at leto.net
>>> http://leto.net
>>
>>
>
>
>
> --
> Jonathan "Duke" Leto
> jonathan at leto.net
> http://leto.net
>



-- 
Jonathan "Duke" Leto
jonathan at leto.net
http://leto.net


More information about the parrot-dev mailing list