SwiftWasm: Run Swift in Browsers
swiftwasm.org
swiftwasm.org
Highly encourage everybody to watch it and how people may interact with JavaScript more and more through things like WASM. Very funny talk too :)
$ wapm install -g jsc
Can then use `jsc` to execute .js, as a REPL or inline expressions: $ jsc -e "console.log([1,2,3].map(x => x*2).reduce((x,acc)=>acc+x))"Wasm can be used in every corner of computing spectrum. It doesn't mean it's some perfect tool to solve all problems but it can lead to interesting places and those are worth exploring.
Wasm's strengths are in running untrusted code - its sandbox is quite strict. So the use case for wasm on mobile is downloading code dynamically. Wasm's competition in this space is JS, not native code.
Sure, but I believe a lot of people will be willing to make a performance tradeoff for that convinience.
Also WASM works in Mobile Safari and SFSafariViewController, but not in WKWebView - which limits its interaction with an app.
I also feel like this is just a weird year for software, because we've got Wasm making huge strides ("let's make it easy to sandbox everything like javascript"), discovered Spectre ("oops, our assumptions about javascript being a good sandbox were maybe wrong, we apparently need to use hardware-enforced process separation"), but also many other permutations of these things in other spaces (such as the WSL2 announcement of a new integrated Windows-Linux environment, vs. containers vs. VMs vs. WSL1 vs. Wine vs. micro-services).
Now if only Apple would put more effort into cross-platform support for Swift...
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.
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.
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.
WebAssembly is also easier and faster to parse for now, but won't be for long, because JavaScript binary AST work is in progress: https://github.com/binast
JavaScript has better access to DOM and is superior otherwise.
JS is a transpilation target and not really for many low level languages.
> JS is a transpilation target
Transpilation is a subset of compilation, so if it is a transpilation target it is, by definition, a compilation target.
[0]: https://github.com/apple/swift-corelibs-foundation/blob/mast...
The excellent package manager (Cargo) makes this a non-issue.
Something like a javascript / flutter style hot reload really accelerates your dev cycle and I wish Swift had it too.
Hot reload is nice but to me is far from a dealbreaker, especially after your app is past the phase where you’re writing a bunch of new UI.
I would be too worried about Apple going full Apple and screwing devs to ever learn Swift.
I think this is a permanent disadvantage for anything B2B.
https://news.ycombinator.com/item?id=19883351
Before I jumped ship to the Apple ecosystem around 10 years ago, I was even then already sick of Microsoft abandoning or being indecisive about their platforms.