4 ms·
I think Python is a good example of how things can happen. Python's standard library includes a lot of pretty frustrating libraries, but offers a lot of low-le
by rtpg 10y ago
I think Python is a good example of how things can happen.
Python's standard library includes a lot of pretty frustrating libraries, but offers a lot of low-level functionality. So people can easily write wrapper libraries with more "pythonic" usage.
Think about requests vs. urllib (though technically requests' backend can be replaced).
I can imagine that Apple could write Swift libraries that are more idiomatic to the language by just wrapping Cocoa stuff. I mean, React Native can exist, so why can't this?
- masklinn 10y ago> a lot of low-level functionality. So people can easily write wrapper libraries with more "pythonic" usage. Think about requests vs. urllib (though technically requests' backend can be replaced). To my knowledge, requests is implemented on top of urllib3 (a third-party library from which it gets most of its advanced feature), not the stdlib's urllib or urllib2.
- rtpg 10y agoAh, I stand corrected. It seems like urllib3 uses Python's socket library stuff though? I guess that part of the code isn't the trickiest part.
- fauigerzigerk 10y agoI agree that wrapping can and does work in most cases. But then there are times when it doesn't work without introducing a lot of complexity and/or inefficiency or without limiting design choices. How will the new concurrency/parallelism facilities they are planning for Swift work with libdispatch queues? Will they want to build on GCD or not? Will whatever they do work for Objective-C just as conveniently? That's an open question in my view. For an example why wrapping cannot work efficiently in all cases look no further than Python 2 vs Python 3 strings. They are conceptually too different. With enough "waste" of resources everything can be wrapped. I don't know how React Native works. But React.js uses a virtual DOM that effectively doubles memory usage. That's what gives them the freedom to use a completely different approach to updating the UI. I put "waste" in quotes because sometimes paying for a more productive and simpler system with higher resource consumption is the right thing to do. But in other cases it is not.
- rtpg 10y agoTo be honest, I don't think the DOM structure itself is what consumes the most memory. It's about priorities, and having the UI building blocks be a bit slower is probably fine, because the actual UI internals will still be fast. How many times do you need to reflow your UI? Though I'm not super aware of what Cocoa actually covers, my impression is that it's mainly UI libraries.