From a48a9efdb4c1b4337a3a809543c016b8df3f4e5d Mon Sep 17 00:00:00 2001 From: John Doty Date: Tue, 20 Jun 2023 05:35:36 -0700 Subject: [PATCH] Some notes --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..9099406b --- /dev/null +++ b/README.md @@ -0,0 +1,46 @@ +# ODEN: A small TypeScript coding environment + +This is just a silly little project which connects a JS interpreter with WebGL and init/update/draw loop in Rust. +You can think about this maybe like Pico-8 except not constrained, or LÖVE but with JS instead of lua. + +## Why? + +1. I want types and type hints and type checking for my little scripts, they're useful. + Lua doesn't have an equivalent of what TypeScript has, except maybe LUAU but that's incompatible with LÖVE, so what would the point be? + +2. I want WebGL because I would like to be able to (easily) run things in multiple places. + I like that you can play Pico-8 games on the web. + Seems like it would be nice to make that work too. + +## Why not? + +1. No operator overloading in TypeScript. + I'm going to get irritated by this quickly I think. + QuickJS actually supports operator overloading but TypeScript doesn't and patching operator overloading into the type-checker looks very difficult. + +## Details + +### JavaScript + +I'm using QuickJS, lightly patched, with my own bindings. + +#### QuickJS + +The easy alternative to QuickJS is to use Deno Core, which binds V8. +Unfortunately, Deno Core has kind of a wild architecture, where it goes through flatbuf for all its communications, and keeps the JavaScript engine at arm's length. +It doesn't expose things like "make a new native class." +And while it feels "possible" to use (see https://deno.com/blog/roll-your-own-javascript-runtime-pt2), it was not quite as easy to use for what I wanted to do as you might like. + +QuickJS may be more or less abandoned by Fabrice Bellard, but also it does what I need it to. + +(But it makes me sad: there are millions of dollars and uncountable engineering-hours in V8. +V8 is one of the best dynamic language runtimes ever constructed by man. +It would be really nice to be able to take advantage of it.) + +#### Lightly Patched + +See above about being abandoned: we have small patches in place to e.g. expose information about modules and whatnot. + +#### My Own Bindings + +The other bindings are maddeningly incomplete, and don't expose features I want to expose out of QuickJS.