Live data from Hacker News

Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

twitter.com

31–40 of 106 posts

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#31
post #9

Earlier quoted context omitted.

I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…

> Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in some huge runtime. Doesnt this just imply building a 'huge runtime' into the language?

Not necessarily. GC can be implemented in a way that's fairly compatible with low-level programming, by leveraging support for multiple address spaces and/or memory segmentation. And WASM needs that kind of support anyway for its planned module-based security.

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#32
post #14

I'm a newer dev so pardon my ignorance. Is webassembly the new, more open JVM? Feels like that write once, run everywhere but this time with any(most) mainstream language.

In a way, but wasm is designed to be a lot better at sandboxing.

Not really, whilst bytecode would be slightly harder to verify than an AST a paranoid interpreter wasn't that hard to craft.

Iirc J2ME impls could be fairly secure (barring bugs since many were written in an age before security became a focus), and I think the spec even mandated pre-computed stack-frames (the expensive part of verification that is easy to post-validate for correctness).

Another part of J2ME was because like wasm/web, the runtime API was fairly small and all code could be contained within the sandbox with only API-extensions allowed to be native functions. (This restricted API and it's quite sad UI capabilities was probably part of why Apple ignored it entirely for iPhones)

What was much worse however was the mainline JVM and the Applets, Applets had from day 1 relied on all kinds of mainline JVM features and this featureset kept growing.

Features were encouraged to be written as much as possible in Java but many still had more or less large native parts. This is in addition to the core that allows for quite a bit of code loading,etc (that was allowed from applets).

All these features and loading that could allow for insecure behaviour was secured by a security policy system, sadly there was so many features that were exposed that used powerful dynamic features (the because they were whitelisted) allowed for untrusted code to behave or do stuff only trusted code should.

https://docs.oracle.com/javase/7/docs/technotes/guides/secur...

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#33
Self-hosting (compilers) https://en.wikipedia.org/wiki/Self-hosting_(compilers) :

> In computer programming, self-hosting is the use of a program as part of the toolchain or operating system that produces new versions of that same program—for example, a compiler that can compile its own source code

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#34
post #9

Earlier quoted context omitted.

I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…

> Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in some huge runtime. Doesnt this just imply building a 'huge runtime' into the language?

FWIW, AssemblyScript[0] adds its own garbage collection runtime into Wasm. The team had a good post recently on the performance implications[1]

[0] https://www.assemblyscript.org/

[1] https://surma.dev/things/js-to-asc/index.html

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#35
post #26

Earlier quoted context omitted.

I think WASM success won't be measured by market share gain on the web, but by number of new non-browser things that are programmed with WASM.

Agreed. An interesting example is the new Microsoft Flight Simulator, which uses WASM[0] as a sandboxed language to create airplane gauges and custom flight models (HN discussion[1]). [0]: https://forums.flightsimulator.com/t/getting-started-with-wa... [1]: https://news.ycombinator.com/item?id=24281400

Very Cool!

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#36
post #9

Earlier quoted context omitted.

I'm somewhat curious at what pace WASM will gain "market share" while it's only practical to target it with C, C++, Rust, etc. Supposedly, there are plans to expand it to where it looks more like a virtual machine and less like ASM. Adding things like garbage collection, direct DOM manipulation, polymorphic inline cache, etc. Things that would make it possible to run a decent scripting language without pulling in som…

I think WASM success won't be measured by market share gain on the web, but by number of new non-browser things that are programmed with WASM.

EOS blockchain contracts are compiled to WASM.

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#37
What is the state of the world with wasm at this point? It seems like it's been this huge tease for 10 years now, promising that we'll be able to build web apps in any language. But as far as I'm aware, garbage collection and DOM access is still nonexistent.

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#38

What is the state of the world with wasm at this point? It seems like it's been this huge tease for 10 years now, promising that we'll be able to build web apps in any language. But as far as I'm aware, garbage collection and DOM access is still nonexistent.

Wish I had a RemindMe! bot on HN for comments like these.

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#39

What is the state of the world with wasm at this point? It seems like it's been this huge tease for 10 years now, promising that we'll be able to build web apps in any language. But as far as I'm aware, garbage collection and DOM access is still nonexistent.

There's no garbage collection in WASM. Why do you think that there is garbage collection in WASM?

And WASM has been around since 2017, which is only 4 years, not 10 years... Bitcoin has been around much longer (~12 years), for example.

Re: Wasm3 compiles itself (using LLVM/Clang compiled to WASM)

#40

What is the state of the world with wasm at this point? It seems like it's been this huge tease for 10 years now, promising that we'll be able to build web apps in any language. But as far as I'm aware, garbage collection and DOM access is still nonexistent.

Well built in garbage collection is non-existent. You can definitely use languages with GCs, you just need to include the GC in the bundle. You can do DOM access as well, it's just not particularly efficient.

Overall I think WebAssembly definitely has some usecases, they're just not as visible as people expected. Sites like Figma or Lichess use WASM but not in a super flashy way.

Post reply on HN