Bug 396697

Summary: remove builtin should not return nil (?)
Product: [openSUSE] openSUSE 11.1 Reporter: Jiří Suchomel <jsuchome>
Component: YaST2Assignee: Martin Vidner <mvidner>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Enhancement    
Priority: P4 - Low CC: locilka
Version: Alpha 0   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Jiří Suchomel 2008-06-03 13:10:41 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
Comment 1 Stefan Hundhammer 2008-06-03 13:32:51 UTC
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.
Comment 2 Stanislav Visnovsky 2008-10-03 10:39:21 UTC
*** Bug 431855 has been marked as a duplicate of this bug. ***
Comment 3 Stanislav Visnovsky 2008-10-07 13:01:15 UTC
'remove' builtins now return unchanged parameter on error.

yast2-core-2.17.16