Ken Fox <[EMAIL PROTECTED]> writes:
>
>This got me thinking about whether it's necessary to define exactly what
>an SV struct is. The following seems over-specified:
>
>
>Dan's struct that includes thread sync stuff is also over-specified.
>
>I think the only thing we have to standardize on is the vtable interface
>and the flags. This seems like a good thing, at least during early
>experimentation with perl 6.


True. I think just the vtable and flags is the minimal "interface" 
rest of the stuff is just data that access functions mess with (even the
thread sync stuff).

None the less - it makes sense to have a "straw man" of how the essential
types will be implemented.

>
>We could wrap the basic operations on an SV with inlines so that the
>abstraction won't kill performance. The entire low-level definition of SV
>could be done in a header file. When building perl just pick what header
>you want. This would have no effect on external modules since they all go
>through the public interface.

>
>BTW, SV isn't a good name for this struct. 

Agreed.

>It's really a value
>binding, not the value itself. 

Nor is this "base" just for scalars - so apart from the fact it isn't a
scalar and isn't a value "scalar value" is ideal :-(

>IMHO it would be a lot easier to read the
>code if we clearly differentiated between what's now called SV and the
>collection of xpv*'s.
>
>> inline IV
>> SvIV(SV *sv)
>> {
>>  return (*sv->vtable.SvIV)(sv);
>> }
>> 
>> With the simplest case being
>> 
>> IV
>> nativeIV(SV *sv)
>> {
>>  return sv->data.words.iv;
>> }
>
>What component of the system is responsible for representation
>shifting? 

The vtable functions.

>It might be a really clean design for us to always shift
>representations so that the current vtable always points to the
>corrent semantics. (Look, ma, no flags required!)

We need to see what the flags turn out to be.
Perl5 has things like IOK, ROK, NOK, POK, UTF8, ...

While those are not always necessary with the vtable stuff, they tend to 
get used by Perl in DWIM mode - it looks at flags to see if thing is 
"naturally" a string or a number.

-- 
Nick Ing-Simmons

Reply via email to