Open amirrajan opened 6 years ago
Implementing a foundational data structure like this has some profound performance aspects. And it’d have to be maintained. Your original thought (from the Slack group) to go with NSSet sounded good to me. To be cross-platform, we could use Java’s HashSet. And then layer over the top of those with the MRI standard library’s Set api, to ensure Ruby dev’s are comfortable/happy with it. We could even use MRI Set’s test suite to validate.
Implementing a foundational data structure like this has some profound performance aspects.
Agreed. I'd say that we'd reference an (already) widely supported C/C++ version. General rule for me is to "go as low as possible" when it comes to "core" pieces (C > C++ > Objective C/Java > Ruby > RubyMotion).
If there isn't a good candidate for these core data structures, then yes, I'd say an NSSet/HashSet polyfill would be best.
And then layer over the top of those with the MRI standard library’s Set api, to ensure Ruby dev’s are comfortable/happy with it. We could even use MRI Set’s test suite to validate.
Mixed feelings about this. If we end up using a lower level C API, it's much simpler to have a 1 to 1 relation between the two (I understand that there would be incompatibilities... but it might be worth addressing those as they come as opposed to upfront).
As far as C++ goes, no one’s gonna build one, when the STL already has one. I did a quick perusal last night, and didn’t find a C lib. Admittedly, it’s been a long time since I was a hard core C developer, so I might not be looking in the right places.
As far as C++ goes, no one’s gonna build one, when the STL already has one. I did a quick perusal last night, and didn’t find a C lib. Admittedly, it’s been a long time since I was a hard core C developer, so I might not be looking in the right places.
Same results for me.
Need a cross-platform implementation of the
Set
data structure. Finding a solid, standalone C++ version (or pure C version), and creating a foreign function interface to it would be best I feel.Take a look at this code to understand how to create an FFI: https://github.com/HipByte/motion-game/blob/master/src/rubymotion.h and https://github.com/HipByte/motion-game/blob/master/src/sprite.cpp