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



* muppet <scott asofyet org> [2004-04-16 05:19]:
if we go to using accessor methods to get data in and out of
the tree at paths, then the tie is, well, pretty much
unnecessary.  a list of lists structure could be used to
represent the data when going in and possibly dumping out.

That's why I went back to think about the tied interface about
halfway through my rambling mail. I realized that what I had
proposed was essentially the same API as is natively offered by
Gtk+ anyway, making the ::Simple stuff moot.

Consider my suggestions for any additional API revoked.

In fact I think I can go back all the way to my data structure
change proposition and make a much more solid proposition,
assuming it is acceptable to switch from 0-based to 1-based
indices for the children.

Status quo, as a reminder:

    {
        value => [ qw/1 2 3 4/ ],
        children => [
            {
                value => [ qw/5 6 7 8/ ]
            },
            {
                value => [ qw/9 10 11 12/ ]
            },
        ],
    }

Proposition:

    [
        [ qw/1 2 3 4/ ],
        [
            [ qw/5 6 7 8/ ]
        ],
        [
            [ qw/9 10 11 12/ ]
        ],
    ]

And then the interface becomes

use constant VALUES => 0;
@{ $stree->{data}[13][4][3][VALUES] } = [...]

I've been staring at this datastructure for a few minutes now,
and I believe it will greatly simplify things on all levels. The
interface is easy to understand and easy to use, does not involve
any made-up syntax, and should be trivial to implement. In
general, this feels like a well designed solution.

I am comfortable saying this is my final proposition. Thanks for
humouring me and hammering on my halfbaked ideas while I thrashed
out the details in my mind -- I hope this was of value to Ross.
:-)

-- 
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]