develooper Front page | perl.perl6.internals | Postings from October 2007

Re: wrapping up the OO implementation

Thread Previous | Thread Next
From:
Patrick R. Michaud
Date:
October 2, 2007 08:23
Subject:
Re: wrapping up the OO implementation
On Tue, Oct 02, 2007 at 07:19:30AM -0700, jerry gay wrote:
> On 10/2/07, Klaas-Jan Stol <parrotcode@gmail.com> wrote:
> > On 10/2/07, Allison Randal <allison@perl.org> wrote:
> > the first file I wanted to fix, t/stm/runtime.t, contains this:
> >
> >     $I0 = find_type 'STMQueue'
> >     if $I0 goto done
> >     class = newclass 'STMQueue'
> >
> > a check is done if the check exists. in the new system, how should this
> > check be done?
> 
> i thought it would be:
>     $P0 = get_class ['STMQueue']
>     if $P0 goto done
>     class = newclass ['STMQueue']
> 
> but that fails with "Class 'STMQueue' doesn't exist"
> [...]
> since the pdd isn't clear on the return value from get_class when a
> class isn't found, i'll leave the decision to allison, but i'd prefer
> a PMCNULL be returned instead of an exception.

I agree, in which case the above would be ...

    $P0 = get_class 'STMQueue'     # or ['STMQueue']
    unless null $P0 goto done
    class = newclass 'STMQueue'    # or ['STMQueue']


(because "if $P0 goto done" will throw a Null PMC exception if 
get_class returns null).

Pm

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About