Earlier quoted context omitted.
Exactly. The frameworks aren't there yet but I think Typescript is pretty much ideal for web dev. We're still using dynamic languages for web dev for mostly legacy reasons now.
Not sure if "ideal" is a good choice of word here. We dont know what's still coming. It surely has some flaws (many inherited from JS). There is stuff like ReasonML/Elm/PureScript that seems more ideal to me from a pure language (not eco sys, job/talent market, etc) perspective.
Moving from TypeScript to Rust / WebAssembly
121–130 of 428 posts
Re: Moving from TypeScript to Rust / WebAssembly
#122I like Rust but I would much rather use Swift for something like that especially if SwiftUI like thing was part of the deal.
Re: Moving from TypeScript to Rust / WebAssembly
#123Earlier quoted context omitted.
What's the hard lesson? Performance? You have more power these days. The bottleneck won't be the interpreter.
Performance yes, there is always more power as long as the bank account is full, and even then it isn't enough when working at scale. The amount of histories of porting code prove otherwise. Note I am not pushing away dynamic languages, only those that don't have a JIT/AOT as part of their canonical implementation. Common Lisp, Julia, JavaScript, PHP (7 and later) are all invited to the party. Meanwhile maybe JRuby o…
Re: Moving from TypeScript to Rust / WebAssembly
#124> webassembly is faster than javascript Everyone says this, but I would dispute it as misleading in a lot of cases. I've been experimenting a lot with wasm lately. Yes, it is faster than javascript, but not by all that much. It's the speed of generic 32 bit C. It leaves a lot to be desired in the way of performance. My crypto library, when compiled to web assembly, is maybe 2-3x the speed of the equivalent javascript…
That is an insane difference even if nowhere close to native code.
Some engineering fields would be crazy with a 20% gain... 200% is huge!
Re: Moving from TypeScript to Rust / WebAssembly
#125Whenever I write Rust, I have a lot of fun, but I'm still not sold on it for most web dev. The analogy that comes to mind is that Rust is a really nice sports car with a great engine. It handles like a dream and you can feel the powerful engine humming while driving it. With the right open road, it's a great time. You can really optimize code, make great abstractions and work with data easily. Unfortunately, web dev…
For backend web development I was somewhat disappointed to see that many of the new web frameworks (all async) allocate extensively on the heap (for example lots of Strings in their http request types.) I mean it works but I don't understand why I would go to the bother of thinking about lifetimes when it seems performance would be similar to Kotlin / Swift / F#.
The only place that the langs you mention probably win is: learning curve (F# maybe not so much) a.k.a. getting language illiterate people up to speed, and compile times.
Re: Moving from TypeScript to Rust / WebAssembly
#126Earlier quoted context omitted.
Mind explaining a bit more here why Rust is a particularly good language to compile to wasm? Why does memory safety help here? Asking out of ignorance!
There isn't necessarily any inherent thing about the language itself that makes it better at WASM than others, it's more that it was one of the first languages that was ready for WASM. - It's low level like C and C++ so it maps cleanly onto WASM - In your average Rust project, all dependencies are already built from source, greatly increasing the likelihood all your dependencies can be built for WASM - Already using…
The solution other languages targeting wasm typically use is bundling their own garbage collector in the compiled code, which of course adds a bit of code bloat. E.g. C# blazor wasm applications are not exactly small for this reason.
There was a message yesterday in the Kotlin slack about them starting work on a wasm compiler backend for Kotlin (they already have java, native, and js compilers). https://github.com/JetBrains/kotlin/tree/master/compiler/ir/... Interestingly they plan to depend on the wasm GC proposal instead of bundling their own: https://github.com/WebAssembly/gc/
So, things are improving on this front. But it's a big reason why Rust is particularly popular for wasm right now because they have no GC and lots of developer tools that are relatively mature because they've been working on this for a while.
IMHO, this will take another few years to fully mature but inevitably lots of people are going to be writing web applications that don't involve any or very little javascript. Kotlin is starting to look very solid for any kind of cross platform Android, IOS, and web based development (as well as server development, which is what I do). Swift would be another candidate and there already is a wasm compiler for that as well.
Re: Moving from TypeScript to Rust / WebAssembly
#127Earlier quoted context omitted.
I'm not certain exactly how LLVM works so I am not sure this is the right question to ask but - How does Web Assembly relate/compare to LLVM? Does LLVM solve the problem of a single binary that can be run portably?
There are not comparable afaik. WASM is also more ambitious, along with WASI (system interface) creating a portable final executable (compare to JVM), whereas LLVM is only a set of intermediate language and tools. When this transition period goes away, LLVM should hopefully compile to WASM binary as a target. The current path described in the video of WASM -> C -> clang -> llvm -> native-binary is a temporary workaro…
LLVM is one of the best toolchains for many languages.
They are completely different things.
Re: Moving from TypeScript to Rust / WebAssembly
#128Earlier quoted context omitted.
Performance yes, there is always more power as long as the bank account is full, and even then it isn't enough when working at scale. The amount of histories of porting code prove otherwise. Note I am not pushing away dynamic languages, only those that don't have a JIT/AOT as part of their canonical implementation. Common Lisp, Julia, JavaScript, PHP (7 and later) are all invited to the party. Meanwhile maybe JRuby o…
But php doesnt have jit...
Re: Moving from TypeScript to Rust / WebAssembly
#129> webassembly is faster than javascript Everyone says this, but I would dispute it as misleading in a lot of cases. I've been experimenting a lot with wasm lately. Yes, it is faster than javascript, but not by all that much. It's the speed of generic 32 bit C. It leaves a lot to be desired in the way of performance. My crypto library, when compiled to web assembly, is maybe 2-3x the speed of the equivalent javascript…
Re: Moving from TypeScript to Rust / WebAssembly
#130Earlier quoted context omitted.
This really nails why languages like PHP and Ruby have won out over static typed, compiled ones for application level web development. The web is a massive collection of disjointed, loosely coupled APIs that all (just barely) interoperate to provide a massive array of functionality. Languages that tend to work well with it are those that are highly flexible around the corner cases of these technologies, and allow you…
Having ridden the 90's .com startup wave with an in-house application server written in a mix of Apache plugins and Tcl, I learned the hard way to never again rely on anything that doesn't bring a JIT or AOT compiler to the party.