At 11:11 AM 9/1/00 -0400, Chaim Frenkel wrote:
> >>>>> "DS" == Dan Sugalski <[EMAIL PROTECTED]> writes:
>
>DS> Okay, here's a list of functions I think should go into variable vtables.
>DS> Functions marked with a * will take an optional type offset so we can
>DS> handle asking for various permutations of the basic type.
>
>
>DS>     type
>DS>     name
>
>What are this used for?

Type returns a magic cookie value of some sort (Not sure what sort yet), 
name returns a string with the name of the type of the variable.

>DS>     get_bool
>
>Is this allowed to return a non-true/false result? Or is everything
>true or false?

Dunno yet. I'm thinking just a true/false value, but...

>DS>     get_string *
>DS>     get_int *
>DS>     get_float *
>
>What does the optional type argument do?

Provides an index into the table of functions.

>What about collection types?

That's up in the air. get_int could, for example, return the number of 
entries in the hash or array. Or not.

>Why not simply collapse these into a single one with an option argument?
>What should a get_* do if inappropriate for its type?

Either return something as best it can (like what we do now when you use a 
string in numeric context, for example) or throw an error.

>DS>     get_value
>
>What does this do that the above three do not?

Raw data.

>DS>     add *
>DS>     subtract *
>DS>     multiply *
>DS>     divide *
>DS>     modulus *
>
>Where is the argument to be added/subtracted/etc. ? On the stack?

Passed as a parameter, I expect.

>DS>     clone (returns a new copy of the thing in question)
>
>Isn't this a deep problem? (Should be near the top of the vtbl

Very, though there's no reason we can't cheat and either pass a 'depth' 
parameter, or just say it's a shallow copy suitable for "@a = @b" situations.

>DS>     new (creates a new thing)
>
>Why does the thing have to do a new? (move earlier)

Sorry, I meant a new instance of whatever variable you're calling it on. 
Probably better off elsewhere.

>DS>     concatenate
>
>DS>     is_equal (true if this thing is equal to the parameter thing)
>DS>     is_same (True if this thing is the same thing as the parameter thing)
>
>How does THIS figure out how to get THAT to give a usable value?

That's what the type parameter's for...

>DS>     logical_or
>DS>     logical_and
>DS>     logical_not
>
>DS>     bind (For =~)
>DS>     repeat (For x)
>
>Are these so that operators can be overriden?

Yup.

>DS> Anyone got anything to add before I throw together the base vtable RFC?
>
>Are you going to fully specify the expected input and results in the RFC?

Certainly better than they are here. :)

                                        Dan

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

Reply via email to