3 ms·
They are in platform specific code, manipulating CoreFoundation types (specifically a CFMutableArray), so your cross-platform homebrew sort suggestion is out of
by arghwhat 8y ago
They are in platform specific code, manipulating CoreFoundation types (specifically a CFMutableArray), so your cross-platform homebrew sort suggestion is out of scope here. Any sorting function would need to be CoreFoundation (iOS/watchOS/macOS) specific.
When possible, it would of course be best to use stdlib functionality, which would implicitly be cross-platform. Writing it yourself, or pulling in third-party libs to do it ranks way below stdlib, although I can't agree with myself whether doing so is better or worse than using OS-specific standard frameworks. Regardless, it is out of scope in this example.
- kalleboo 8y agoThe post I was replying to was talking about "Excel data", which I interpret as spreadsheet data. Do you really think that when you sort a column in Excel, it puts the whole thing into a CFMutableArray and asks CoreFoundation to sort that?
- arghwhat 8y agoNo, as I wrote, I would assume any use of CoreFoundation types are only used in platform specific code (dealing with UI, system events, etc.), which would be a minority of the code base, and entirely unique to the platform. Using CoreFoundation in such code is entirely sensible. Generalizing a sort for something like this would be a waste of time with no gains (as long as the functionality is used correctly, like not assuming a non-specified sort to be stable). However, for the actual business logic, the hierarchy would be: stdlib > large third-party cross-platform lib > small third party cross-platform lib ≈ homegrown implementation.