[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: A common base exception object for Perl - RFC
Pete Jordan <pjordan1@email.mot.com> writes:
>Nick Ing-Simmons wrote:
>
>> SV *MakeObject(SV *raw, char *class)
>> {
>> SV *sv = newRV_noinc(raw); /* typically you don't want to inc refcount */
>> HV *stash = gv_stashpv(class, TRUE); /* Find stash for class name */
>> return sv_bless(sv, stash); /* bless raw into class via new RV */
>> }
>
>Thanks :)
>
>> So we would need a new API which had extra "desired class" args.
>
>Just so. The difficulty (in C) is generalising it; class is fine, but
>how do you specify class-specific properties (assuming a programmer has
>their own special Exception class that needs to be set up correctly)?
In the limit you can just call my $obj = SomeClass->new(...);
from the C side:
PUSHMARK(sp);
XPUSHs(sv_2mortal(newSVpv("SomeClass")));
...
PUTBACK;
perl_call_method("new",G_SCALAR);
SPAGAIN;
sv = POPs;
Let us find out what perl-side objects are first and worry about
generic C API when we know what it has to do.
--
Nick Ing-Simmons
- Follow-Ups from:
-
Pete Jordan <pjordan1@email.mot.com>
- References to:
-
"Redford, John" <John.Redford@fmr.com>
Pete Jordan <pjordan1@email.mot.com>
Stephen Zander <gibreel@pobox.com>
Pete Jordan <pjordan1@email.mot.com>
Nick Ing-Simmons <nick@ing-simmons.net>
Pete Jordan <pjordan1@email.mot.com>
Nick Ing-Simmons <nik@tiuk.ti.com>
Pete Jordan <pjordan1@email.mot.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]