Earlier quoted context omitted.
My impression following swift forums is that original core team members were very concerned about relying a lot on first principles, whereas the new generation is more about building powerful constructs, in a fast paced way.
The new generation doesn't seem to have a need for extracting substrings from strings then. The existing Swift syntax for slicing strings [1] is horrible. [1] https://www.cocoaphile.com/posts/string-slicing-in-swift
Swift Regrets
191–200 of 207 posts
Re: Swift Regrets
#192Earlier quoted context omitted.
> Objective-C is quite fast–in many cases faster than Swift–and as (memory) safe as Swift for the most part. Ehhhh. If you write Swift the same way you write Obj-C, it will generally be as fast or faster. You only fall off the happy performance path when you use Swift features that don't even exist in Obj-C. That's not Swift being slower, that's Swift letting you use abstractions that aren't possible in Obj-C. But yo…
> That's not Swift being slower, that's Swift letting you use abstractions that aren't possible in Obj-C. But you don't _have_ to use them. What happens in practice is that the libraries you're consuming use them, and then you have to use them.
I find it hilarious that Obj-C devotees object to this, since it precisely mirrors their argument for decades in the face of bogus performance complaints: “you can just use normal C functions”. They were right then, and you can just use Obj-C libraries today.
Re: Swift Regrets
#193Earlier quoted context omitted.
The new generation doesn't seem to have a need for extracting substrings from strings then. The existing Swift syntax for slicing strings [1] is horrible. [1] https://www.cocoaphile.com/posts/string-slicing-in-swift
That article is terrible. Simple wrapping a string in Array() converting it to characters achieves what the author desired and makes the rest of the article pointless.
Re: Swift Regrets
#194Earlier quoted context omitted.
In my experience post-ARC almost all memory safety issues are thread-safety related.
Except ARC only works for Cocoa like classes, everything else is traditional C like memory management.
Re: Swift Regrets
#195Re: Swift Regrets
#196Earlier quoted context omitted.
> Meanwhile Objective-C is slow, unsafe by default, with super ugly syntax only a mother could love. More than half of Apple's CVE/iOS vulnerabilities lately have been from parts of the OS that still use ObjC, Objective-C is quite fast–in many cases faster than Swift–and as (memory) safe as Swift for the most part. Most of Apple's CVEs come from code written in C or C++, not Objective-C.
> Objective-C is quite fast–in many cases faster than Swift–and as (memory) safe as Swift for the most part. Ehhhh. If you write Swift the same way you write Obj-C, it will generally be as fast or faster. You only fall off the happy performance path when you use Swift features that don't even exist in Obj-C. That's not Swift being slower, that's Swift letting you use abstractions that aren't possible in Obj-C. But yo…
Re: Swift Regrets
#197Earlier quoted context omitted.
This shouldn’t be true, ObjC’s only innate advantage is compile time, because the compiler is simply doing less and is capable of producing far worse (unsafe) code. At runtime Swift can utilize static dispatch, where objective C is mostly dynamic. Good swift code should generally be faster.
> This shouldn’t be true Performance isn't about what you believe should be true, but about what actually is true. Kinda like science. (versus religion) > ObjC’s only innate advantage is compile time Objective-C has a bunch of advantages. Compile time isn't really one of them, except when compared to Swift, which is ridiculously slow to compile. And there are languages with very comparable feature sets to Swift that…
Re: Swift Regrets
#198So is Objective-C kinda going away after all? If I did a greenfield iOS or OSX app would it be malpractice to do it in Objective-C? Because I actually adore that language. Haven’t used it lately, but I do love it.
Re: Swift Regrets
#199Earlier quoted context omitted.
That article is terrible. Simple wrapping a string in Array() converting it to characters achieves what the author desired and makes the rest of the article pointless.
The article is only for demonstrating how standard library works (it was the first Google result for me). The point is we shouldn't need to convert a string to an array of characters to manipulate it.
Yes we should. Unicode strings have ambiguous lengths. I would encourage you to try slicing Unicode strings sometime to understand why this is true.
Consider the black Santa emoji. What is the length of that emoji? Backspacing an emoji deletes it, so it could be one. But then how would you substring slice out the skin color component of the emoji?
Converting a string to an array yields the symbols on the screen separated by the cursor position, but that’s not a true representation of the data.
Re: Swift Regrets
#200Earlier quoted context omitted.
It was really solved by reference counting, way back when Foundation was introduced. The ARC increment was tiny.
Tiny? It made it so you’d never have to deal with an overrelease ever again…
Not sure what you're on about with the "overrelease" bit, but all ARC did was automate things with additional compiler support that were already automated.
And it caused additional crashes in code that shouldn't even be able to crash:
https://blog.metaobject.com/2014/06/compiler-writers-gone-wi...