Now if only Apple would put more effort into cross-platform support for Swift...
Now if only Apple would put more effort into cross-platform support for Swift...
While it's not intentional, but there's a fair level of similarity between the techniques I find myself using in Typescript and Swift – to the point where I've been able to transcribe some Swift code into Typescript when porting between platforms. Something to do with the "feel" of the language, maybe?
Swift is definitely one of my favourite languages to work with – something about the style of programming it invites just seems to click with me. I agree it would be really nice to use it more extensively, because so far it's just been a single-purpose language and that seems like a bit of a shame.
Under the hood, JS and python are very similar, bit idiomatic JS and idiomatic Python couldn't me different. To me, idiomatic Swift/Rust feels like idiomatic JS, whereas idiomatic Go is more like idiomatic Python.
They are so different, only very superficial comparisons of syntax would lead to such a statement.
The array/dictionary literal syntax (especially dictionaries) was probably the main thing. Lots of languages have similar array syntax (though fewer have the auto-grow behavior), but I can't think of another C-like language with first-class, dedicated dictionary syntax.
C-likes also don't often have first-class functions/closures, or named function parameters (JS doesn't technically have the latter, but it effectively does with object destructuring; this is one of the syntax niceties Swift added).
I didn't mean to imply they had an overall similar set of features, so much that someone who's comfortable with TypeScript would have a pretty easy time warming up to Swift, which matters on the web.
I think C is the only remaining C-like language not to have first-class functions. And there are compiler extensions for that too.
You made the mistake of thinking Swift is a programming language and not just the Apple API.
https://forums.swift.org/t/swift-as-a-cross-platform-languag...
Anyhow, the Windows API (.net, C#) is better and has a brighter future and present.
Swift is much closer to the metal than .NET, and it has very innovative syntax features. It's more analogous to Rust than to C#. .NET is a strong cross-platform ecosystem, but it's silly to say "we don't need any others because this one's good enough". It's not even the strongest one that currently exists - probably the JVM is. It honestly just sounds like you're hating on Apple for the sake of it.