@neauoire could you please elaborate a bit? What do you mean exactly?
@alex27 the logic of this application is all done in the uxn side, I could even spawn html elements directly in the page, from uxn-space.
@neauoire so it's like cgi? Or i'm getting it wrong? I just didn't saw any js in picture
@alex27 somewhat yeah, but all in front-end
@charlag @alex27 I already had a wasm implementation of uxn, this one is written in js itself.
https://git.sr.ht/~rabbits/uxn5/tree/main/item/src/uxn.js
@neauoire oh, right! I forgot about that web playground..
@neauoire @alex27 you do write kind of a class thing but without class syntax. That's okay and stylistic.
However, you used arrow functions for all your functions. This is technically correct but practically it instantiates an object per each function (unless its optimized away and I wouldn't bet on it). This is because arrow functions are bound to their `this` so they need an allocation to keep that info. Consequence is a bit of wasted memory and maybe fewer optimizations applied (cont.)
@neauoire @alex27 I would recommend one of:
1. Write it as a class and use shorter syntax for functions:
class Uxn {
pop() {}
}
2. old-style
Uxn.prototype.pop = function() {}
this way you have no additional instances for functions, they are all stored on prototype. It will also avoid mixing "static" things and "per instance" things like errors array that you have
@neauoire I really like how simple question resulted into improvement. I like fedi
@charlag what that will improve?
@neauoire it's so short o_O
@changbai the C version is even smaller
https://git.sr.ht/~rabbits/uxn11/tree/main/item/src/uxn.c
@neauoire so you basically have translator to js?
@vanderZwan my plan is to run unicycle.rom in this web repl, and have a little interpreter in the uxntal.html documentation so people and type in little programs like: https://skilldrick.github.io/easy6502/
@neauoire nice, interactive documentation right can be so useful for learning when done right!
(fwiw, I was trying to make a tongue-in-cheek Blazing Saddles reference)
@vanderZwan Oh, I have never seen Blazing Saddles, that was lost on me, sorry XD
@neauoire hahaha, no worries!
In case you're curious, the joke is somewhere in this short clip: https://www.youtube.com/watch?v=nB1E0oAAc-w
That probably gives you enough of an impression to decide whether or not a satirical black comedy from the seventies written by Mel Brooks/Richard Pryor is your thing :)
@neauoire @vanderZwan
I love easy 6502. I never finished that course, but it gave me massive appreciation for all the software I saw as a kid.
I'm amazed anyone could get *anything* done with that ISA 🤣
6502 was RISC before RISC.
@neauoire JS returning to xxiivv!? 😛
@neauoire excellent idea!
this might open new possibilities for the online tutorial 🤔
@neauoire gotta feel a little cathartic
@peregrine at first I felt a bit sick doing this. Building this little thing made feel infinitely grateful that I'm not writing in this silly language this for a living.
@peregrine Ultimately, building js interop with uxn means that I've secured that I will never have to write js again. If I ever do, I'll write my web application logic entirely in uxn.
@neauoire 100%
@neauoire Your boat almost burned down, and you’re able to focus on coding?
Wow. That’s another level entirely.
(In a situation like that, I’d barely be able to handle email.)
@kgerloff they burnt after I made this
@neauoire Oh, ok. I really hope your boat didn´t get damaged too badly, and you can get it back in shape quickly!
I wrote a tiny self-hosted repl.rom yesterday, so I wondered if maybe I couldn't just load that rom in js and have a little evaluator on the Uxntal documentation for visitors to experiment with.
https://wiki.xxiivv.com/site/uxntal.html