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



* Ross McFarland <rwmcfa1 neces com> [2004-04-15 04:21]:
any opinions? someone speak up. there's been several people say
they want such a thing. if not one is interested it can drop
it.

I wonder if the Perl-side view of the tree structure couldn't be
made a little less verbose. How about using arrays instead of
hashes like this:

Currently:

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

Proposition:

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

The position of the children list as first element in the array
disambiguates whetere it is an arrayref that happens to be one of
the values or the children list.

Neither form is very pleasurable to work with, but I don't think
there's much difference. The first is extremely verbose though.

All in all, I like the code, though.

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