by PopsiclePete · 8y ago · 0 comments
I find the omission of features like namespaces really strange. I realize that namespaces don't jive with how Obj-C and Obj-C frameworks see the world and that Swift and Obj-C need to play together, but dealing with global namespace pollution and collisions in 2018 just seems...sad? They're hobbling the language in various ways due to NS*/Cocoa framework stuff.
Another weird omission is lack of any kind of concurrency story. Right now, this just seems like Apple's "me-too" version of Java/C#, but what does it actually bring to the table that would make it a worth-while investment if I'm not an iOS developer?
...and part 2 here: https://medium.com/@qutheory/server-side-swift-vs-the-other-...
And here's summer 2017 benchmarking/comparing server side Swift frameworks vs. Node: https://medium.com/@rymcol/updated-benchmarks-for-the-top-se...
Swift is a great language.
Hello World in Java:
public class HelloWorld {
public static void main(String[] args) {
// Prints "Hello, World" to the terminal window.
System.out.println("Hello, World");
}
}Hello World in Swift:
print("Hello World")
Obviously Hello World is trivial, however that comparison is indicative of the elegance -- it has power similar to C with ease of use similar to scripting languages.
In the end, Swift is terrible. If you are developing on MacOS, stick with Objective-C. It’s a much better language.
Grand Central Dispatch (GCD or libdispatch) is generally the concurrency story on Darwin platforms. There has been an ongoing effort to port it to Linux. Not sure how complete that is but I linked the Github below. Swift on Linux still has a lot of rough edges in general.
I imagine if you tried hard enough you could find edge cases that work on macOS but not on Linux, but the Linux support is complete enough for everyday production work.
Concurrency is still a work in progress in swift, in the most fundamental levels.
let mutex = DispatchQueue(label: “”)
mutex.sync { /* protected code here */ }
As for @sychronized, the devs have talked about why it is flawed (requires double locking) and why use should always use a manual mutex scope.EDIT: aren't you the one that wrote this article ? :))
If you're not a Mac or iOS developer, then it doesn't bring anything right now.
IMO, nobody is going to use this cross platform. Some people are trying to make it happen, but I doubt very much that it's going to be popular.
Well… in the sense that it is Yet Another Programming Language, you're right in some regard. Nonetheless…
> IMO, nobody is going to use this cross platform. Some people are trying to make it happen, but I doubt very much that it's going to be popular.
Those "some people" include IBM, who are behind the Kitura framework and are also porting Swift to their heavy PowerPC iron. They seem to be trying to make it into sort of a next-generation Java without the terribleness.
Yeah, it still maybe won't catch on as broadly as Java did, but it already has some enterprisey support outside of Apple. We'll see.
Never heard of them or used any of their software products. What other popular software have they brought to market?
There are probably goos reasons for doing it this way, but it always feels weird having to declare all your namespace's types inside one of its member.