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.


@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 @alex27 if it’s all server side render how’s the page relay events back to the vm?

@neauoire so it's like cgi? Or i'm getting it wrong? I just didn't saw any js in picture

@neauoire @alex27 which means it's probably interpreting uxn with js or wasm

@neauoire oh, right! I forgot about that web playground..

@neauoire @alex27 do you want quick comments on js or rather nah?

@charlag @alex27 sure, if it's not stylistic things. I haven't written any JS in a long long time so there might be new conventions I don't follow or something.

@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

@neauoire @alex27 also I would recommend declaring your script as a module `<script type="module"> and using ES6 import/export facilities

@alex27 @neauoire 1. strict mode will be automatic
2. can explicitly use export what is needed instead of just dumping everything into one namespace.
2. Can reorganize code like needed
3. Can reuse it somewhere else
4. editors will understand what's going on better.

@charlag @alex27 yeah that's a bit beyond the scope of what I'm trying to do here, but thanks for the tip ^^

@neauoire @charlag @alex27
Is it pretty easy to take standard C code and compile for WASM?

@RL_Dane @charlag @alex27 it's "easy" to install emscripten, but that application is massive and slow. I'm not a fan.

@neauoire @RL_Dane @alex27 there are other compilers but they are more "restricted", emscripten is indeed bulky


> Wrote a program in uxn.

"That's not much of a crime."

> a Javascript program?

"… kinky"

@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: 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 :tealheart: excellent idea!
this might open new possibilities for the online tutorial 🤔 :uxn:

@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 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.)

@neauoire Oh, ok. I really hope your boat didn´t get damaged too badly, and you can get it back in shape quickly!

Sign in to participate in the conversation

Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.