News for hackers. Stuff that matters.
Re:Swift UTF-8 String by cageface on Friday March 22, 2019 @02:41AM (#19460110)
If GC pauses aren't an issue for your app then you're better off with a full-blown GC because it's a lot easier to code for. Reference counting, as used in Swift, forces you to think a lot about cases where you might be creating reference cycles and memory leaks. GCs can figure this out for you and take that burden off the programmer.
Re:Swift UTF-8 String by millstone on Friday March 22, 2019 @04:19AM (#19460453)
One of the major advantages of reference counting is that it's easier to integrate with other languages. For example you can manipulate Swift objects from C via CoreFoundation, which then allows them to be used from C++, Rust, whatever.

GC'd languages have some support (JNI, etc) but they require handles, pinning, write barriers, etc. which ends up being more complicated and less flexible.

Re:Swift UTF-8 String by cageface on Friday March 22, 2019 @05:29AM (#19460794)
Right, which is one of the reasons it makes sense for Apple to use it, since they have a lot of lower level C API to interact with.

For more general purpose backend work this is not usually a major consideration though, which is one of the reasons I predict most backend work will continue to be done in a GC language.

Re:Swift UTF-8 String by saagarjha on Friday March 22, 2019 @03:38AM (#19460296)
Yes, but reference counting doesn't have unpredictable pauses, which can be important in certain situations. That's what I was trying to say above.