Re: Storing external data in PMCs

[email protected] (Arthur Bergman)
Newsgroups perl.perl6.internals,perl.ponie.dev
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.