http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13240
M. Tompsett <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #4 from M. Tompsett <[email protected]> --- (In reply to Frédéric Demians from comment #3) > You replace: > > my $digest = $due_digest->{$upcoming->{'borrowernumber'}} ||= {}; > $digest->{email} ||= $from_address; > $digest->{count}++; > > With: > > $due_digest->{$upcoming->{borrowernumber}}{email} = $from_address; > $due_digest->{$upcoming->{borrowernumber}}{count}++; > > But why exactly? Why create variables when you don't need to? Are we so desperate for speed that much that we want to lose simple readability? > The first syntax is Perlish, with ||=, but not to the point > to be unreadable. To those unfamiliar with Perl "pointers" (for a lack of a better word, since it is a NEW syntax to me), it is unreadable. Once you realize that $digest "points" to what $due_digest->{$upcoming->{'borrowernumber'}} points to, then it does make sense. > And the second syntax uses autovivification which isn't > that readable either. Actually, autovivification is far more readable and understandable than using a secondary pointer to fill in another data structure. > And the second syntax uses $h->{}{} which isn't so > good: $h->{}->{} should be preferred, imho. I agree with Frédéric Demians on this, though only because it makes the change more apparently equal to me, not because it actually generates a better or different data structure. -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
