In message <a05111b04b98fae4c4fe8@[63.120.19.221]>
          Dan Sugalski <[EMAIL PROTECTED]> wrote:

> Have you taken a look at the proposed ops in PDD6? They may not be
> what we ultimately want to use, but it might be a place to start.
> (And I'd rather avoid generic vtable access to keys if at all
> possible, for speed reasons. They're our internal structures--we can
> screw with them as we need :)

Fine. Those ops are a bit of a mish mash though - even the naming
isn't very consistent.

Likewise, why is there a chop_key to remove from one end (and which
end is "topmost" anyway) but nothing to remove from the other, or to
add at either end (beyond resizing the key completely).

I would suggest that useful operations might include some or all of
the following:

  - creating a new key (new_key)
  - cloning a key (clone_key)
  - discard a key (destroy_key)

  - get number of key elements (key_size)
  - get type of key element (key_type)
  - get value of key element (key_value)
  - set value of key element (key_set) [deduces type from argument]
  - increment value of key element (key_increment)
  - decrement value of key element (key_decrement)
  - add new element to end of key (key_push)
  - remove element from end of key (key_pop)
  - add new element to start of key (key_unshift)
  - remove element from start of key (key_shift)

As I say, it isn't clear that we need all of these - adding and removing
at the end is probably more useful than adding and removing at the start
for example.

The other question is what key_type should return - the idea of magic
numbers isn't particularly nice but I'm not sure what else we can do
there. Assuming that it is even useful for code to be able to determine
the type of an element of course - surely code will normally know the
type of elements in a key it is manipulating?

Tom

-- 
Tom Hughes ([EMAIL PROTECTED])
http://www.compton.nu/

Reply via email to