In this case I assume the function can either be Perl5 or Parrot?
Sounds like a custom PMC to me. Given the PMC that
could stash function pointers and correctly dispatch gets/sets
you have the option of writing a PNI method for setting the stashed
routine from C or we have to add a call to the extension API to stash a
raw pointer.
-Melvin
Arthur Bergman <[EMAIL PROTECTED]>
10/27/2003 10:35 AM
To: Melvin Smith <[EMAIL PROTECTED]>
cc: [EMAIL PROTECTED], [EMAIL PROTECTED]
Subject: Re: Storing external data in PMCs
On Monday, October 27, 2003, at 03:26 pm, Melvin Smith wrote:
>
> At 02:56 PM 10/27/2003 +0000, Arthur Bergman wrote:
>> So I am currently trying to do a Perl5LVALUE pmc, a stumbling block
>> is however that I need to pass the PMC the thing that it is
>> lvalueling, I was planning to use the pmc data field for storing this
>> but I cannot access it as a extender without violating the API and
>> guessing at layouts which is kind of bad (Dan says so ;)
>
> I don't know Perl5 internals enough to know exactly what Perl5LVALUE
> does. Do you want a way to pass a value to the PMC and let the PMC
> type morph
> itself based on the data representation?
>
> -Melvin
>
>
An lvalue holds usually a function, and when set is called that
function is called. So no morthing required at all!
For example:
perl -le '$foo = hi; $bar = \substr($foo,1); print "$bar-$foo"; $$bar =
"b"; print "$bar-$foo"';
LVALUE(0x513ec)-hi
LVALUE(0x513ec)-hb
so the reference points to a lvalue which has a reference to $bar and a
special function on the set to actually execute the substr.
The reason I am starting with this is that it is so obscure that it is
hardly used anywhere and is limited to a few small areas in the core
making it a good testing ground.
Arthur