On 10/2/07, Klaas-Jan Stol <[EMAIL PROTECTED]> wrote: > On 10/2/07, Allison Randal <[EMAIL PROTECTED]> wrote: > > > > My goal was to wrap up the pdd15oo branch by the end of September. We're > > quite close. The two remaining big things are PGE and multiple dispatch, > > and then test cleanup. Thanks to chromatic and particle for their work > > on the tests. > > > > I've been giving chromatic small tasks to work on, which seems to be a > > good way of breaking out the load. Here are a few anyone could tackle: > > > > - Pick a directory and grep (or ack) for 'find_type'. It was a common > > idiom in the old object system that doesn't work any more. Change: > > > > $IX = find_type "ClassName" > > $PX = new $IX > > > > to: > > > > $PX = new "ClassName" > > > > 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" so instead you'll have to do something like: .local pmc class push_eh eh_no_class $P0 = get_class 'STMQueue' clear_eh goto done eh_no_class: class = newclass 'STMQueue' addattribute class, 'head' addattribute class, 'tail' addattribute class, 'used' addattribute class, 'array' done: .return() ...which is much more verbose. 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. looking at the code, Parrot_oo_get_class(), which implements the bulk of the get_class opcode, returns PMCNULL. the get_class opcode detects PMCNULL and throws an exception instead of passing it through. ~jerry