At 05:30 PM 8/31/00 -0400, Ken Fox wrote:
>Dan Sugalski wrote:
> >     get_value
> >     set_value
>
>Wouldn't these go on the SV and not on the inner type? Maybe I'm
>thinking value when you're saying variable?

Nope. The get/set value functions are for when something knows what the SV 
(or whatever we call it) really is and can handle the raw data. For 
example, if my code knew a SV held a complex number (which doesn't map well 
to the int/float/char translation) and I could handle it, then I'd call 
get_value and get the raw data.

>The following seem useful
>on variables too:
>
>   before_get_value
>   after_get_value
>   before_set_value
>   after_set_value
>
>There ought to be specializations of get_value and set_value
>that call these hooks if they're defined -- no sense in making the
>normal case slow.

You could override the vtable function in that case, I think.

>We also need GC functions:
>
>   allocation_size      -- size of required (or actual) allocation

I can see that.

>   children             -- nested SV *s (for live object traversals)

I'm not sure. Maybe.

>   move                 -- move object to new memory location

Don't think this is needed. The base SV structures won't move, I think, and 
we should be able to move the variable's contents (hanging off the sv_any 
analog) at will.

>   resize_granted       -- object's resize request was granted

I don't think this is needed--the guts of the set functions would handle 
this as needed.

>   finalize             -- release private resources before destruction

Ah, yep. Destroy. Forgot that one.

>The clone function should take a depth parameter so that lazy
>deep copies can be type specific.

Hadn't gotten that far, but it's a good idea.

>Is is_same an identify function? Or does it check the type?

Identity. If two SVs pointed to the identical same data, this'd return true.

>Either
>way it seems like that could be implemented on the SV and not on every
>type.
>
>What purpose do the logical_* functions serve? Shouldn't there just be
>one is_true function that the logical_* ops call?

In case one wants to overload

   @foo || @bar

to do a piecewise logical or of the two arrays.

>Persistence functions would be really useful too:
>
>   freeze
>   thaw

Cool, makes sense. Might be the wrong place for it, but it can't hurt to 
think about it and remove it later if need be.


                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to