The GNUStep implementation of -[NSArray removeLastObject] differs from the Apple implementation. In GNUStep, exceptions are thrown when an array is empty and the -removeLastObject method is called:
- (void) removeLastObject
{
NSUInteger count = [self count];
if (count == 0)
[NSException raise: NSRangeException
format: @"Trying to remove from an empty array."];
[self removeObjectAtIndex: count-1];
}
In Apple implementations, the -removeLastObject method just silently exits when there are no elements to remove.
To improve compatibility for codebases used across both implementations, I think this exception raise should be dropped in favor of just a return.
The GNUStep implementation of
-[NSArray removeLastObject]
differs from the Apple implementation. In GNUStep, exceptions are thrown when an array is empty and the-removeLastObject
method is called:In Apple implementations, the
-removeLastObject
method just silently exits when there are no elements to remove.To improve compatibility for codebases used across both implementations, I think this exception raise should be dropped in favor of just a return.