Bring -compare: implementations inline with macos#508
Conversation
updates the implementation of `-compare:` vs a `nil` argument to return the same results as the same code running on macos (output from a sample program on macos): ``` NSString 'compare:' nil arg: NSOrderedDescending NSDate 'compare:' nil arg: NSOrderedSame NSNumber 'compare:' nil arg: exceptions `-[__NSCFNumber compare:]: nil argument` ```
rfm
left a comment
There was a problem hiding this comment.
While removing the code to raise NSInvalidArgumentException for invalid arguments is not OK, modifying it to behave differently depending on the compatibility requested by the GSMacOSXCompatible user default would be great.
Traditionally that would have meant calling the -boolForKey: method to see whether runtime compatibility with undocumented/undefined/bad OSX behaviors had been requested. However, you can now also use the new GSMacOSXVersion() function to get the value of the default in the same format as the OSX version constants defined in GSVersionMacxros.h in order to match the undefined behaviors in particular versions of OSX.
This would allow you to set the GSMacOSXCompatible user default to make GNUstep behave as your framework expects until that framework is updated so that it's no longer needed.
|
Closing since the patch emulates an officially undefined behavior specific to a particular implementation/version (indeed, Apple documentation says that you must not pass nil to these methods) and the existing code in the base library is more rational and intuitive. |
updates the implementation of
-compare:vs anilargument to return the same results as the same code running on macos (output from a sample program on macos):Related issue: #507