Okay, here's what I'm currently thinking of for standard representations of
integers, numbers, strings, and (possibly) complex data. These are not
necessarily indicative of how the data's stored in scalars (or hashes or
arrays), merely the types that will need to be dealt with in the vtables.
In addition to each of the types below, each vtable will have a 'same type'
entry that'll be used if the optimizer can guarantee that the scalars
involved in an operation are of the identical type. (Presumably things can
be faster that way)
For integers, we have two types, platform native, and bigint. No guarantees
are made as to the size of a native int. bigints can be of any size.
For floats, we also have two types, C double and bigfloat. No guarantees to
the size or accuracy of the double. bigfloats can be of any size.
Strings can be of three types--binary data, platform native, and UTF-32.
No, we are not messing around with UTF-8 or 16, nor are we messing with
EBCDIC, shift-JIS, or any of that stuff. Strings can be stored internally
that way (and the native form might be one of them) but as far as the
interface is concerned we have only three. Yes, this does mean if we mess
with strings in UTF-8 format on a non-UTF-8 system they'll need to be fed
out in UTF-32. It's bigger, but we can deal.
Finally, complex numbers, if we deal with them, will be either double or
bigfloat complexes. (I don't see any reason to mess with integer versions,
nor with mixed double/bigfloat types)
And, unless Larry objects, I feel that all vtable methods should have the
option of going with a 'scalar native' form if the operation if it's
determined at runtime that two scalars are the same type, though this is
optional and bay be skipped for cost reasons. (Doing it with, for example,
complex numbers might be worth it, or when expensive conversions might be
avoided)
Comments? I'm trying to balance out accuracy and DWIMmery with cost here,
and I'm not 100% sure things are quite right yet.
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk