4 ms·
Is this sarcasm I might be missing? Thanks for confirming that WebAssembly still cannot manipulate DOM in 2024. It can only call custom javascript functions t
by hu3 2y ago
Is this sarcasm I might be missing?
Thanks for confirming that WebAssembly still cannot manipulate DOM in 2024.
It can only call custom javascript functions that manipulate DOM AND I need to write some arcane function signature language for every DOM manipulating function I want to call.
I'll give another 4 years and see if they fixed this.
- xscott 2y ago> I need to write some arcane function signature language for every DOM manipulating function You really don't know that you can create WebAssembly in other languages?!? I used WAT to keep the example short, but that's clearly lost on you. > I'll give another 4 years and see if they fixed this. In that time, there are lot of things you could be learning. Embracing ignorance and belligerence isn't like to serve you well in the long term.
- DonHopkins 2y ago[flagged]
- xscott 2y ago> Thanks for your simple concrete examples and explanations! I'm glad someone liked it :-) > I love his description of Forth as "a weird backwards lisp with no parentheses" I've been interested in that duality between Forth and Lisp before, but my progression always seems to following this path: - Since Forth is just Lisp done backwards and without parens, and since it's not hard to write an sexpr parser, I might as well do Lisp to check the arity on function calls. - But in addition to arity errors, I'd really like the compiler to catch my type errors too. - And since I've never seen an attractive syntax for Lisp with types, I might as well have a real grammar... And then I've talked myself out of Forth and Lisp! Oh well.
- DonHopkins 2y agoPostScript is kind of like a cross between Forth and Lisp, but a lot more like Lisp actually. And its data structures, which also represent its code, are essentially s-expressions or JSON (polymorphic dicts, arrays, numbers, booleans, nulls, strings, names (interned strings), operators (internal primitives), etc.) https://donhopkins.medium.com/the-shape-of-psiber-space-october-1989-19e2dfa4d91e https://donhopkins.medium.com/the-shape-of-psiber-space-octo... Not coincidentally, James Gosling designed the NeWS window system and implemented its PostScript interpreter, years before designing and implementing Java. And before that he designed and implemented "MockLisp" in his Unix version of Emacs, which he self effacingly described like: "The primary (some would say only) resemblance between Mock Lisp and any real Lisp is the general syntax of a program, which many feel is Lisp's weakest point." https://news.ycombinator.com/item?id=29954778 https://news.ycombinator.com/item?id=29954778 James Gosling's Emacs Mocklisp was like FEXPRs on PCP, with support for prompting the user to supply omitted arguments. https://news.ycombinator.com/item?id=14312249 https://news.ycombinator.com/item?id=14312249 DonHopkins on May 10, 2017 | parent | context | favorite | on: Emacs is sexy Hey at least Elisp wasn't ever as bad as Mock Lisp, the extension language in Gosling (aka UniPress aka Evil Software Hoarder) Emacs. It had ultra-dynamic lazy scoping: It would defer evaluating the function parameters until they were actually needed by the callee (((or a function it called))), at which time it would evaluate the parameters in the CALLEE's scope. James Gosling honestly copped to how terrible a language MockLisp was in the 1981 Unix Emacs release notes: https://archive.org/stream/bitsavers_cmuGosling_4195808/Gosl https://archive.org/stream/bitsavers_cmuGosling_4195808/Gosl 12.2. MLisp - Mock Lisp Unix Emacs contains an interpreter for a language that in many respects resembles Lisp. The primary (some would say only) resemblance between Mock Lisp and any real Lisp is the general syntax of a program, which many feel is Lisp's weakest point. The differences include such things as the lack of a cons function and a rather peculiar method of passing parameters. "Rather peculiar" is an understatement. More info, links and code examples: https://news.ycombinator.com/item?id=8727085 https://news.ycombinator.com/item?id=8727085 Comparison of PostScript with Forth and Lisp: https://news.ycombinator.com/item?id=22456471 https://news.ycombinator.com/item?id=22456471 [...] PostScript is much higher level than Forth, and a lot more like Lisp than Forth, and has much better data structures than Forth, like polymorphic arrays (that can be used as code), dictionaries (that can be used as objects), strings, floating point numbers, and NeWS "magic dictionaries" that can represent built-in objects like canvases, processes, events, fonts, etc. Yet Forth doesn't even have dynamically allocated memory, although in a few pages of code you can implement it, but it's not standard and very few Forth libraries use it, and instead use the linear Forth dictionary memory (which is terribly limited and can't be freed without FORGETting everything defined after you allocated it): https://donhopkins.com/home/archive/forth/alloc.f https://donhopkins.com/home/archive/forth/alloc.f PostScript is homoiconic. Like Lisp, PostScript code IS first class PostScript data, and you can pass functions around as first class objects and call them later. https://en.wikipedia.org/wiki/Homoiconicity https://en.wikipedia.org/wiki/Homoiconicity [...]
- reshlo 2y ago> it’s just a standard s-expression syntax I.e. they are correct that it is arcane. What percentage of programmers today do you think have ever seen code written in any Lisp dialect, let alone understand it?
- xscott 2y agoI wonder what the response would've been if I had left the WAT source code out and just claimed, "this WASM binary was built with a compiler", and not specified the language.
- em-bee 2y agoi would have liked to see the source. how would the example look like when written in python for example? and how would it compare with non-wasm javascript?
- xscott 2y ago> how would the example look like when written in python for example? That seems like an easy question, but there a lot of choices which complicate it. I'm sure people have compiled CPython to WebAssembly, but I think you only get the WebAssembly imports they (or Emscripten) have chosen for you. I can't use that as an example of what I was trying to show. It looks like py2wasm is aiming for a true Python to WASM compiler, rather than compiling an interpreter. However, I don't think it supports user-defined imports/exports yet. There's a recent issue thread about this (https://github.com/wasmerio/py2wasm/issues/5 https://github.com/wasmerio/py2wasm/issues/5). > how would it compare with non-wasm javascript? I'm not sure I understand the question. If you're just using JavaScript, it just looks like JavaScript.
- em-bee 2y agoso does that mean accessing the DOM from python is not possible yet? for the second question the example you gave is equivalent to what in plain html/js?