find_name doesn't obey docs on unbound

Patrick R. Michaud pmichaud at
Fri Feb 19 14:15:34 UTC 2010

On Fri, Feb 19, 2010 at 12:41:22PM +0100, Jonathan Worthington wrote:
> Jonathan Leto wrote:
> >.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

You're essentially correct that the docs don't match here.
In general we don't want find_name to always throw an
exception because there are many times that it's valid
to look for something that doesn't exist.  Jonathan is
quite correct that in many of our target languages,
the fact that a particular symbol doesn't exist is an
indication that it needs to be created, not that an
exception should be thrown.

There is a "find_sub_not_null" option that has the
same semantics as "find_name", but does throw an exception
if the requested symbol does not exist.  Perhaps this will
do what you need.  :-)


More information about the parrot-dev mailing list