7 ms·
> 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 writt
by 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?
- xscott 2y ago> so does that mean accessing the DOM from python is not possible yet? No. It means you only get what the person who ported CPython or py2wasm gave you. It's not a limitation in WebAssembly, and maybe they have some other (hopefully better) API than the `easy(123)` example I was trying to show. > for the second question the example you gave is equivalent to what in plain html/js? If I understand what you're asking, it's just: <!doctype html><title>plain jane</title> <script type="module"> function easy(arg) { const div = document.createElement("div"); div.textContent = "DOM this: " + String(arg); document.body.appendChild(div); } easy(123); easy(456); </script>
- em-bee 2y agoIt means you only get what the person who ported CPython or py2wasm gave you that's what i meant. it's not possible until someone adds the necessary features to the wasm port of the language. makes sense of course, like any feature of a new architecture. If I understand what you're asking exactly that, thank you. it is easier to understand the example if there is no doubt as to what is the js part and what is wasm (it also didn't help that the code was not easy to read on a phone)
- foldr 2y agoThe point is that anyone who's distracted by the arcanity of Web Assembly Text Format obviously doesn't understand the first thing about WASM or its potential use cases. The poster could just have easily have used a regular programming language and compiled that down to a WASM binary. However, for the purposes of a minimal example to be pasted in a text box, this might have led to a much larger Uint8Array.
- DonHopkins 2y agoWhat percentage of programmers on Hacker News haven't? Flaunting your ignorant anti-intellectualism isn't a good look. You do know this is 2024, you have Internet access, and you can just look shit up or ask ChatGPT to learn new things, instead of cultivating ignorance and pointlessly criticising programmers trying to raise awareness, share their experiences, and educate themselves and other people. In case you've been living under a rock and didn't realize it, JavaScript, the topic of this discussion, is essentially a dialect of Lisp, with garbage collection, first class functional closures, polymorphic JSON structures instead of s-expressions, a hell of a lot more like and inspired by Lisp and Scheme than C++, and LOTS of people know it.
- reshlo 2y agoMy point is that if someone says something is arcane, “it’s not, it’s just [something that you’ve potentially never heard of and almost definitely don’t understand even if you have heard of it]” doesn’t help your case. They could look it up, but the fact that they would have to do so proves the commenter’s point - relatively few programmers understand Lisp syntax, i.e. it is arcane. If you’re trying to raise awareness of something, don’t act like the reader is stupid if they don’t already understand. Insisting that something is obvious, especially when it is not, means any reader who does not understand it will likely perceive the comment as snobby. As does including snide remarks such as “in case you’ve been living under a rock”. > Flaunting your ignorant anti-intellectualism isn’t a good look. Why do you assume that I personally don’t know what s-expressions are just because I agree that they’re arcane? Labelling someone as an ignorant anti-intellectual just because they disagree with something you said isn’t a good look either.
- hu3 2y agoExactly. I, like most devs, know what Lisp is. I, like most devs, just don't care.
- DonHopkins 2y ago[flagged]