| ▲ | spankalee 12 hours ago |
| Rust is better at targeting WebAssembly |
|
| ▲ | cowsandmilk 11 hours ago | parent | next [-] |
| why would that be important? Having a typescript compiler in wasm seems like a pretty niche need. |
| |
| ▲ | Benjamin_Dobell 3 hours ago | parent | next [-] | | It's extremely useful if your distribution platform is the web. However, I find it much more valuable as a type checker than a compiler. I use TypeScript extensively (in several projects) for defining schemas types. For example, in the Breaka Club (https://breaka.club/) editor, which is not presently exposed to kids yet, we define behaviors for characters, props, mosaics (terrain tiles) and items in JSON. But the JSON has type checking and real-time completion as you type. Not naive property auto-suggestion, we have effect types and they're context aware in that you can refer to targets introduced higher in parent constructs of the JSON — and they're fully type checked. If you refer to a target that does not exist in a context, it won't validate and you cannot save the schema. We use tsgo for development, but the editor (runtime schema validation) is presently stuck on TypeScript 6 because there's no WASM support. Now, is it nutty that we're using TypeScript for JSON validation? A little. But it's extremely powerful. We're going far beyond what's capable with Zod or ArkType. | |
| ▲ | pjmlp 5 hours ago | parent | prev | next [-] | | Because you need to keep the compiler running here, - https://www.typescriptlang.org - https://code.visualstudio.com/docs/remote/vscode-web | |
| ▲ | tcfhgj 2 hours ago | parent | prev | next [-] | | But it's not the only niche, see Typst compiler in wasm for live document generation in the browser. | |
| ▲ | viraptor 8 hours ago | parent | prev [-] | | Theo is making a new twist on the idea of IDE which hosts the application itself. I'm sure there's going to be a video about it soon. But the idea is to embed the whole compilation and type-check in wasm in the browser which then runs the app immediately, as the agents edit the code. |
|
|
| ▲ | teki_one 11 hours ago | parent | prev | next [-] |
| Why? |
| |
| ▲ | spankalee 11 hours ago | parent | next [-] | | Wasm is a first-class target for Rust, which produces faster and smaller Wasm binaries. My understanding is that you need to use TinyGo to reasonably target Wasm with Go. Go having a garbage collector isn't necessarily bad, since Wasm has GC, but I think Go's GC can't easily use Wasm GC because Go has interior pointers. | | |
| ▲ | win311fwg 6 hours ago | parent [-] | | WASM is also a first-class target for Go (gc). However, it has a relatively large runtime, so TinyGo is often preferred when bundle size needs to be small. |
| |
| ▲ | 0x696C6961 11 hours ago | parent | prev | next [-] | | I think the main advantage is size. Rust doesn't need to include the runtime. | |
| ▲ | cmrdporcupine 11 hours ago | parent | prev [-] | | I'm assuming they mean because it doesn't need a garbage collector or much of a runtime at all. You can target direct to WASM and use I guess WASI, while Go brings with it a garbage collector and so on. |
|
|
| ▲ | pebal 5 hours ago | parent | prev [-] |
| WASM makes no sense and has no future. |
| |
| ▲ | pjmlp 5 hours ago | parent [-] | | It does here, https://www.typescriptlang.org | | |
| ▲ | pebal 4 hours ago | parent [-] | | I’m not saying it doesn't work. I’m saying it’s a waste of resources and won’t gain widespread popularity. The current trend is porting source code to languages that generate native code. | | |
| ▲ | pjmlp 4 hours ago | parent | next [-] | | I dislike the WebAssembly advocacy of some folks, where they act as if there weren't similar attempts all the way back to UNCOL in 1958, and even in recent history, seem to only focus on JVM, while ignoring the CLR and BEAM. However, there are indeed some cases where it does make sense since we have it around anyway, and one of them is running the Typescript compiler in the browser, now that it is written in a compiled language. | |
| ▲ | dwattttt 4 hours ago | parent | prev | next [-] | | Languages that target WebAssembly _are_ languages that generate native code? C & Rust for example. | |
| ▲ | josephg an hour ago | parent | prev [-] | | > I’m saying it’s a waste of resources A waste of what resources? Other people's time? That isn't up to you to decide. I think your comment is a waste of resources. But how you spend your time isn't up to me. And how wasm people spend their time isn't up to you. > The current trend is porting source code to languages that generate native code. Cool story, but without wasm, how are you gonna run that native code in a browser? | | |
|
|
|