From: SourceForge.net <no...@so...> - 2004-09-06 11:03:08
|
Bugs item #1022151, was opened at 2004-09-04 00:20 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1022151&group_id=10894 Category: 07. Variables Group: current: 8.4.7 Status: Open Resolution: None Priority: 5 Submitted By: Andreas Kupries (andreas_kupries) Assigned to: miguel sofer (msofer) Summary: 'array unset' inconsistency ? Initial Comment: IMHO the behaviour of the command 'array unset ?pattern?' is inconsistent, and the problem is exacerbated by an ambiguous description in its manpage. Take an array variable, add some elements, then execute (1) unset a (2) array unset a (3) array unset a * [This has to be done independently, not one after the other] Tracing and checking the results of the commands shows that the scenarios (1) and (2) are equivalent. Whereas the regular pattern for this type of command is to make (2) and (3) equivalent. However when reading the documentation for 'array unset' it seems to imply the (2)/(3) equivalence: Unsets all of the elements in the array that match pattern (using the matching rules of string match). [...] If pattern is omitted and arrayName is an array variable, then the command unsets the entire array. Because of the first sentence it can be assumed while reading the last sentence that 'unsetting the entire array' means the removal of all elements in the array, and not the removal of the variable. Only then reading them disconnected it becomes clear that the last sentence means that the variable is unset, not its elements. Either documentation or behaviour should be fixed. Preferably both. ---------------------------------------------------------------------- >Comment By: Donal K. Fellows (dkf) Date: 2004-09-06 12:03 Message: Logged In: YES user_id=79902 IMO the behaviour is inconsistent with the way the rest of the core operates (in terms of filtering) and so is *wrong*. I think we should fix the code and make sure that the documentation says what it should as well. Note that this may be a POTENTIAL INCOMPATABILITY, but it is at least following the Principle of Least Surprise... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1022151&group_id=10894 |