Re: Gtk2::Simple::Tree (preview)
- From: Ross McFarland <rwmcfa1 neces com>
- To: "A. Pagaltzis" <pagaltzis gmx de>
- Cc: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Gtk2::Simple::Tree (preview)
- Date: Thu, 15 Apr 2004 07:28:13 -0400
On Wed, 2004-04-14 at 23:45, A. Pagaltzis wrote:
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.
that was one of the two ways i thought about doing it, well with the
values first and then the children, but same difference. basically my
reasons against it where it makes for unreadable code:
@{$stree->{data}[12][1][3][1][2][0]} = [...];
if you're new at things and you see that you're likely to run away
screaming. whereas
@{$stree->{data}[12]{children}[3]{children}[2]{values}} = [...]
might be more verbose, but it's nearly self documenting, 13th element's
4th child's 3rd child ... by far the most common case (especially with
SimpleTree) is a two level list. categories and members of those
categories. in that situation the hash version doesn't get too ulgy.
Neither form is very pleasurable to work with, but I don't think
there's much difference. The first is extremely verbose though.
i don't disagree about the hash form being pretty verbose, but i guess i
think the verbosity is worth it. i guess we could make both versions if
there were enough people who felt strongly enough about it, but i'd
really rather not.
All in all, I like the code, though.
cool.
-rm
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]