News for hackers. Stuff that matters.
Re:Modern C++ Won't Save Us by Razengan on Tuesday April 23, 2019 @02:05AM (#19725980)
What are the hidden language hacks in Swift?
Re:Modern C++ Won't Save Us by Someone on Tuesday April 23, 2019 @03:38AM (#19726384)
I wouldn’t call them hacks, but there are things in the runtime that you can’t implement yourself in Swift. Examples (corrections welcome):

- you can’t allocate memory and then turn it into an Swift object.

- you can’t write Decodable in pure Swift (reflection isn’t powerful enough to do “set the field named “foo” in this structure to “bar”)

- reference counts are hidden from Swift code (yes, there’s swift_retainCount to read them, but that’s documented as returning a random number (https://github.com/apple/swift/blob/master/docs/Runtime.md) because it should not be used). So, if the compiler emits more reference count logic than needed in the data structure that your library uses, there’s no way to improve on it.

Re:Modern C++ Won't Save Us by fooker on Tuesday April 23, 2019 @03:59AM (#19726476)
There are a lot more of these, I can't find a comprehensive list unfortunately.