u/thomasballinger
thomasballinger
thomasballinger
Binaryen has a JavaScript build, so you can write WAT code and get it to Wasm
thomasballinger
We checked in with Tweag and they were already working on it! And yes, that's the idea — I haven't done anything with this, but I bet it's in the works.
thomasballinger
Another shameless plug: for understanding the mechanics of running WebAssembly in the browser/Node.js I have a short video: https://m.youtube.com/watch?v=pkw9USN_Tko
There's always some JS involved, toolchains like the Rust toolchain generate it for you but it can be useful to see the fundamental APIs in JS.
thomasballinger
Cool! I did a quarter-baked version that uses binaryen, cool to see yours be based off the C impl instead https://observablehq.com/@ballingt/compiling-a-subset-of-lox-to-wasm
thomasballinger
Either should be possible. If you don't think matplotlib seems suitable, you're probably using the high level interfaces. For this plot you'll need to use lower level primitives, writing for loops where you draw rectangles, especially those green/yellow/blue gradients. Start with "how to draw a polygon" or a line in Matplotlib, you'll need a lot of each.
Sure, it's doable in D3. If you already know JavaScript or Python, use the tool in the language you already know if you have time pressure. If the goal is to put this in a pdf, that's a bit more straightforward in Matplotlib.
Other libraries or tools: dunno, if you're willing to compromise on the figure, probably! If you need something exactly like your example, then something low level like D3 or Matplotlib is your ticket.
thomasballinger
To see the data structure for the example at https://observablehq.com/@d3/zoomable-sunburst click the arrow next to the "data" cell output to expand it, or try typing partition(data) in a new cell to see how that processes it.
thomasballinger
I added a note to an issue about help, I hadn't thought about preserving preferences. Thanks, I'll try to get to this this week! https://github.com/thomasballinger/endless-web/issues/3
thomasballinger
Indeed I haven't worked on this in quite a while, but please try it and if you run into issues let me know!
I think I patched in some rough mobile controls, enough to play a bit!
thomasballinger
chorded jk using the plugin arpeggio. On systems without the plugin installed, jk and kj.
thomasballinger
Maybe my comment is clearer replacing "someone still has to do that" with "someone still has to build something that will do that, agreed that if Kubernetes were "replaced" it would have to be by something else. WebAssembly could be relevant in this process if Kubernetes WebAssembly support lagged behind another tool's.
thomasballinger
I can't see the future, it might well not take off — but the race is on, it just takes time to build and tool these new host environments! If you want to be paid to work on a wasm runtimes and schedulers it's a good time for that, many companies are working on this. The biggest gap is time.
"What is the default environment for AWS Lambda" is going to be a lagging indicator of popularity, AWS Lambda is too big to change this default quickly. Fastly and Cloudfront and other smaller players are going present WebAssembly execution environments that play to its strengths, developers will use they and love them (or not), the tooling will get better, and eventually it'll seem obvious better for some applications but not work the switching cost for most, and then eventually eventually (or not) it will be the default way to write serverless code.
thomasballinger
WebAssembly is a low-level language and runtime environment (aka virtual machine) that's close to real assembly languages in a way that makes it very quick to compile it the rest of the way. It doesn't have syscalls. Instead it can call functions of (and have its own functions called by) its "host environment."
The most exciting thing to me about it is that it's in browsers, I can write C or Rust that runs in the browser after being compiled to WebAssembly! But there's more money in providing services, so a lot of commercial interest is in running WebAssembly on servers instead of web browsers.
To run code in a browser, it needs to be sandboxed: JavaScript on a sketchy website should not be able to take over your computer, so WebAssembly has the same requirement. There's no "allow Silverlight/Flash/Java to run on this webpage," WebAssembly just runs! It should also be pretty lightweight, these functions are going to be used like calling a JavaScript function, and there might be hundreds of WebAssembly module instances on a single web page. This sandboxing and small footprint (in memory, start up time, external resources) makes running a WebAssembly function lighter weight than a native process! (although the host environment it runs in might be a big process itself).
Kubernetes schedules containers to run, containers are sandboxed processes. Turns out this is a convenient way to run a lot of code, so it's a big thing. What if Kubernetes scheduled WebAssembly modules/functions instead? It could do more of them!
As to replacing Kubernetes, well someone still has to do that, it hasn't happened yet. But maybe the jobs of scheduling containers and scheduling WebAssembly modules are so different that Kubernetes will not add support or the support it will offer won't be as slick as something else new.
thomasballinger
Thanks for the pointers (I hadn't realize Tweag wasn't a person) and generous offer! I know there are other projects that would like this (Quarto is the one that's spurring my recent interest) that might move slower but also care about this enough to contribute. I just emailed Tweag.
Ah this is helpful, sounds possible but like I'll need to learn more about linking. I need to learn more about toolchains other than Emscripten.
thomasballinger
If it's your first rodeo, I would try writing this with JavaScript first, because all the DOM interaction will still need to be JavaScript. Then swap out pieces you'd rather write in Rust by calling the functions from JS, eg physics for a frame.
thomasballinger
Is this what you're looking for? Any of these?
According to the npm page for esri-loader you can now use arcgis-core instead, which I get more hits for when I search on the Observable site.
thomasballinger
I just created one! Search for Endless Sky in the vscode extension panel. Not complete yet, but already useful imo.
thomasballinger
Do you have this compiling with Emscripten at all yet? You'll want to install emsdk and give it a shot using em++.
I just make an npm package of C++ code with embind, and posted a simple example too. These both use ES6 modules, with a hack for creating a separate build each for web and node.
It's hard to know what you're missing, have you made npm modules before? Here are some things I've found:
- you want to compile to
-o .js - you probably want to preload your data manually if you're using
--preload-file - if you just want node, it's easier not to use
-s EXPORT_ES6even though ES6 modules are nice
Have you make npm modules before? You want to ship your something.js and something.wasm at least.
thomasballinger
Threading (with shared array buffers, threading with message passing has always worked) is back in Chrome and Firefox, you need to enable cross origin isolation. It is not back in Safari.
thomasballinger
Chrome's working for me on an emulator right now for me, https://files.catbox.moe/mh2u0a.png
Memory usage and problems saving are my two guesses. I filed an issue for the Firefox problem on our separate repo for the web build.
thomasballinger
I need to get an android tablet to debug it, we should be able to make it work! u/janisozaur who did most of the hard porting work has gotten it work before. I've probably accidentally added a feature that doesn't work there. I'd love to know what error you see! I'm downloading Android Studio rn, hopefully that's enough to debug.
thomasballinger
Here you go! And here's the diff to see how I changed it.
thomasballinger
That's ship mass — I had forgotten so I checked by clicking on the notebook and editing the cell of the chart and found
Plot.dot(data.ships, {
x: 'cargo-space',
y: 'empty-hull-cost',
r: 'mass',
sort: d => -d.mass,
stroke: colorBy,
strokeWidth: 1,
filter: d => plugins.includes(d.plugin),
...
thomasballinger
If you visit the full notebook you can add the Galactic War plugin ships too. If there's another plugin you want to see let me know!
thomasballinger
https://play-endless-web.com (not an official project of the team, but a close derivative) has been updated to a bit past v0.9.14.
Hi Lidinzx I'm excited to say that a Convex Svelte 5 client is nearing release! Check it out at https://github.com/get-convex/convex-svelte.