Bugzilla – Bug 396697
remove builtin should not return nil (?)
Last modified: 2008-10-07 13:01:15 UTC
OK, it is documented correctly [1]: "Remove the value with the key KEY from a map. Returns nil if the key is invalid." IMHO it would be friendlier if the function would return the unchanged map if the key does not exist (see e.g. bug 396666 for a problem that could be avoided). I'm not sure, however: maybe someone expects the nil value, which is documented... [1] http://forgeftp.novell.com/yast/doc/SL10.3/tdg/YCPBuiltinMap_remove.html
IMHO the proposal makes a lot of sense - the documented behaviour, however, does not. It forces every application to wrap the remove() call in checks for nil or for the key that is to be removed. It's destructive.
*** Bug 431855 has been marked as a duplicate of this bug. ***
'remove' builtins now return unchanged parameter on error. yast2-core-2.17.16