[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATCH: Don't use hash in traverse_variable_recursively
From: |
Alexandre Duret-Lutz |
Subject: |
Re: PATCH: Don't use hash in traverse_variable_recursively |
Date: |
Thu, 10 Jul 2003 21:56:02 +0200 |
User-agent: |
Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux) |
>>> "Hari" == Raja R Harinath <address@hidden> writes:
Hari> Hi,
Hari> 'traverse_variable_recursively' uses refs as keys in a hash to detect
Hari> recursively defined variables.
Is this bad practice? (A serious question.)
Hari> This patch avoids using the hash by using an attribute
Hari> 'scanned'. I expect this attribute will also serve as a
Hari> indicator that the variable has been examined.
Hari> Index: ChangeLog
Hari> from Raja R Harinath <address@hidden>
Hari>
Hari> Avoid using refs as hash keys.
Hari> * lib/Automake/Variable.pm (_new): New attribute 'scanned'.
Hari> (%_vars_scanned): Remove.
Hari> ($traversal): New.
Hari> (traverse_variable_recursively)
Hari> (traverse_variable_recursively_worker):
Hari> Use $traversal instead %_vars_scanned to detect recursively
Hari> defined variables.
Nice! Since $traversal is private I would prefix it with an
underscore ($_traversal), like the hash it replaces.
Also ---it probably doesn't matter because it seems difficult to
overflow $_traversal--- wouldn't it make sense to reset
$_traversal in Variable::reset()? Whatever you decide, please
go ahead and install it.
Thanks!
--
Alexandre Duret-Lutz