Re: Gtk2::Simple::Tree (preview)



* Ross McFarland <rwmcfa1 neces com> [2004-04-15 20:41]:
yeah, but having 10 ways to do stuff isn't always a good idea.
(heh)

And sometimes it is. This class would be a pretty fundamental
thing, as data structures generally have this odd tendency :) to
be.

How many ways can think of to build a loop in Perl? How many to
write a guard statement? Sure, not all of them are used
constantly, but sometimes it's good to have the option.

Likewise I think an interface to something as fundamental as this
class should offer a lot of options.

my first thoughts are that the tied interface would actually be
just as fast if not faster

Tieing adds OO method lookup overhead *and* tie magic overhead on
top of that. It can never be as fast as something along the lines
of passing a path or an index list.

reguardless from my preliminary expiriments performance (of the
bindings) don't seem to be an issue, and if they are, you
should be using the tree directly, not the simple interface.

Of course. It would be nice to get 98% of the performance with
only 10% of the inconvenience though.

@{ $stree->{data}[12][3][2] ??? } = [...]

i'd have to think about it for a while to figure out if that
would be possible/reasonable. from the tie level you don't know
that you're the last one, so how would you know to return your
value instead of your children.

Well that's what the "???" meant -- there has to be a way to
retrieve the values from the last object returned.

Anyway, I'll see if I can stir up the stuff on dual objects that
are also tied things.

http://search.cpan.org/dist/Object-MultiType/ may also offer
inspiration.

-- 
Regards,
Aristotle
 
"If you can't laugh at yourself, you don't take life seriously enough."



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]