I cannot defend him, and I cannot refute Ralphβs experience.
The pursuit of symmetry could be a factor. Given that #remove: returns an object that has been deleted, it makes sense to have #add: return the added object.
Simple examples dodge us, I think, as well. When we have an object that is already added to a variable, or it is a simple literal, the return value seems meaningless. But if we have (dubious) code that looks like this:
someProfile add: VirtualMachine youngSpaceEnd - VirtualMachine oldSpaceEnd
If someProfile is a linear list, I suggested that you can get the added value: 'ed through last. But it can be just a bag or a set. In this case, it may be convenient:
currentSize := someProfile add: VirtualMachine youngSpaceEnd - VirtualMachine oldSpaceEnd
Some find it better than:
someProfile add: (currentSize := VirtualMachine youngSpaceEnd - VirtualMachine oldSpaceEnd)
Although best of all:
currentSize := VirtualMachine youngSpaceEnd - VirtualMachine oldSpaceEnd. someProfile add: currentSize
Travis griggs
source share