Why Does ArrayAppend Return True and ListAppend Returns the List
Nothing major, but if you are the curious type there was an interesting question today on stackoverflow. It is one of those simple things that you probably use every day, but may not stop to wonder "why is it this way?".
Why does arrayAppend return true and listAppend return the list?
I suspect the mutability issue is probably the biggest reason. But I seem to recall another suggestion (maybe on houseoffusion.com). I believe the poster suggested it might be linked to the fact that arrays are java.util.Vector's. So it is very likely arrays use the Vector.add(Object) method. According to the api the add() method should return a boolean value:
http://java.sun.com/javase/6/docs/api/java/util/Vector.html#add(E)
http://java.sun.com/javase/6/docs/api/java/util/Collection.html#add(E)
But that does raise another question. Are there any circumstances under which ArrayAppend(..) would actually return false?
0 comments:
Post a Comment