4 ms·
I can't imagine they're using the OS sort for actual spreadsheet data. It's probably for something else like filenames or whatever, and it ends up not finding t
by kalleboo 8y ago
I can't imagine they're using the OS sort for actual spreadsheet data. It's probably for something else like filenames or whatever, and it ends up not finding the file it's expecting in the place it's expecting.
- snaily 8y agoAgreed, especially since I (the GP) thought about this the wrong way - _Apple_ has chosen to use bubble sort as a compatibility measure for some Microsoft apps, not the other way around.
- krotton 8y agoWhich was possible because Microsoft decided to use Core Foundation APIs for sorting instead of their own implementation for spreadsheet data. Or maybe it's not for spreadsheet data, but just their custom file picker or something?
- arghwhat 8y agoIt's a framework-provided sort, not an OS sort. Its use is no weirder than using stdlib sorts, such as Go's "sort" package (which does either a quicksort, heapsort or shellsort, depending on the input length). However, relying on stability if it is not specified is a bad thing.
- deleted 8y ago[deleted]
- kalleboo 8y agoWhile I'm not a big fan of reinventing the wheel, when you're maintaining a 31-year-old cross-platform app that the majority of the planet's businesses rely on for their calculations, I'd be using a custom cross-platform math/sorting/etc engine rather than delegating to any OS, framework, stdlib, third-party anything. Considering this is Microsoft, where Office 4.2 for Mac was as close to WINE as you could get in the 90's, I'm assuming they're doing the same.
- arghwhat 8y agoThey 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.