Fabrice Bellard Releases MicroQuickJS

1507 pointsposted a month ago
by Aissen

170 Comments

antirez

a month ago

If this had been available in 2010, Redis scripting would have been JavaScript and not Lua. Lua was chosen based on the implementation requirements, not on the language ones... (small, fast, ANSI-C). I appreciate certain ideas in Lua, and people love it, but I was never able to like Lua, because it departs from a more Algol-like syntax and semantics without good reasons, for my taste. This creates friction for newcomers. I love friction when it opens new useful ideas and abstractions that are worth it, if you learn SmallTalk or FORTH and for some time you are lost, it's part of how the languages are different. But I think for Lua this is not true enough: it feels like it departs from what people know without good reasons.

norir

a month ago

I don't love a good deal of Lua's syntax, but I do think the authors had good reasons for their choices and have generally explained them. Even if you disagree, I think "without good reasons" is overly dismissive.

Personally though, I think the distinctive choices are a boon. You are never confused about what language you are writing because Lua code is so obviously Lua. There is value in this. Once you have written enough Lua, your mind easily switches in and out of Lua mode. Javascript, on the other hand, is filled with poor semantic decisions which for me, cancel out any benefits from syntactic familiarity.

More importantly, Lua has a crucial feature that Javascript lacks: tail call optimization. There are programs that I can easily write in Lua, in spite of its syntactic verbosity, that I cannot write in Javascript because of this limitation. Perhaps this particular JS implementation has tco, but I doubt it reading the release notes.

I have learned as much from Lua as I have Forth (SmallTalk doesn't interest me) and my programming skill has increased significantly since I switched to it as my primary language. Lua is the only lightweight language that I am aware of with TCO. In my programs, I have banned the use of loops. This is a liberation that is not possible in JS or even c, where TCO cannot be relied upon.

In particular, Lua is an exceptional language for writing compilers. Compilers are inherently recursive and thus languages lacking TCO are a poor fit (even if people have been valiantly forcing that square peg through a round hole for all this time).

Having said all that, perhaps as a scripting language for Redis, JS is a better fit. For me though Lua is clearly better than JS on many different dimensions and I don't appreciate the needless denigration of Lua, especially from someone as influential as you.

brabel

a month ago

> it feels like it departs from what people know without good reasons.

Lua was first released in 1993. I think that it's pretty conventional for the time, though yeah it did not follow Algol syntax but Pascal's and Ada's (which were more popular in Brazil at the time than C, which is why that is the case)!

Ruby, which appeared just 2 years later, departs a lot more, arguably without good reasons either? Perl, which is 5 years older and was very popular at the time, is much more "different" than Lua from what we now consider mainstream.

rweichler

a month ago

I read this comment, about to snap back with an anecdote how I as a 13 year old was able to learn Lua quite easily, and then I stopped myself because that wasn't productive, then pondered what antirez might think of this comment, and then I realized that antirez wrote it.

CapsAdmin

a month ago

It sounds like you're trying to articulate why you don't like Lua, but it seems to just boil down to syntax and semantics unfamiliarity?

I see this argument a lot with Lua. People simply don't like its syntax because we live in a world where C style syntax is more common, and the departure from that seem unnecessary. So going "well actually, in 1992 when Lua was made, C style syntax was more unfamiliar" won't help, because in the current year, C syntax is more familiar.

The first language I learned was Lua, and because of that it seems to have a special place in my heart or something. The reason for this is because in around 2006, the sandbox game "Garry's Mod" was extended with scripting support and chose Lua for seemingly the same reasons as Redis.

The game's author famously didn't like Lua, its unfamiliarity, its syntax, etc. He even modified it to add C style comments and operators. His new sandbox game "s&box" is based on C#, which is the language closest to his heart I think.

The point I'm trying to make is just that Lua is familiar to me and not to you for seemingly no objective reason. Had Garry chosen a different language, I would likely have a different favorite language, and Lua would feel unfamiliar and strange to me.

c-smile

a month ago

Lua syntax is pretty good for DSL (domain specific language) cases / configuration definitions.

For example Premake[1] uses Lua as it is - without custom syntax parser but with set of domain specific functions.

This is pure Lua:

   workspace "MyWorkspace"
      configurations { "Debug", "Release" }
   
   project "MyProject"
      kind "ConsoleApp"
      language "C++"
      files { "**.h", "**.cpp" }
   
   filter { "configurations:Debug" }
      defines { "DEBUG" }
      symbols "On"
   
   filter { "configurations:Release" }
      defines { "NDEBUG" }
      optimize "On"

In that sense Premake looks significantly better than CMake with its esoteric constructs. Having regular and robust PL to implement those 10% of configuration cases that cannot be defined with "standard" declarations is the way to go, IMO.

[1] https://premake.github.io/docs/What-Is-Premake

vegabook

a month ago

Lua has been a wild success considering it was born in Brazil, and not some high wealth, network-effected country with all its consequent influential muscle (Ruby? Python? C? Rust? Prolog? Pascal? APL? Ocaml? Show me which one broke out that wasn't "born in the G7"). We should celebrate its plucky success which punches waaay above its adoption weight. It didn't blindly lockstep ALGOL citing "adooooption!!", but didn't indulge in revolution either, and so treads a humble path of cooperative independence of thought.

Come to think of it I don't think I can name a single mainstream language other than Lua that wasn't invented in the G7.

garganzol

a month ago

JavaScript in 2010 was a totally different beast, standartization-wise. Lots of sharp corners and blank spaces were still there.

So, even if an implementation like MicroQuickJS existed in 2010, it's unlikely that too many people would have chosen JS over Lua, given all the shortcomings that JavaScript had at the time.

IshKebab

a month ago

Not to mention the 1-based indexing sin. JavaScript has a lot of WTFs but they got that right at least.

rwmj

a month ago

Out of interest, was Tcl considered? It's the original embeddable language.

MangoToupe

a month ago

> If this had been available in 2010, Redis scripting would have been JavaScript and not Lua.

This would have been a catastrophic loss. Lua is better than javascript in every single way except for ordinal indexing

dustbunny

a month ago

I also strongly disliked luas syntax at first but now I feel like the meta tables and what not and pcall and all that stuff is kinda worth it. I like everything about Lua except some of the awkward syntax but I find it so much better then JS, but I haven't been a web dev in over a decade

Hendrikto

a month ago

> If this had been available in 2010, Redis scripting would have been JavaScript and not Lua.

Thank god it wasn’t then.

nxobject

a month ago

+1 for the incredibly niche (but otherwise make-it-or-break-it) fact that PUC-Rio is and likely always will be strict C89 (i.e. ANSI C). I think this was (and still is?) most relevant to gamedev on Windows using older versions of MSVC, which has until recently been a few pennies short of a full C99 implementation.

I did once manage to compile Lua 5.4 on a Macintosh SE with 4MB of RAM, and THINK C 5.0 (circa 1991), which was a sick trick. Unfortunately, it took about 30 seconds for the VM to fully initialize, and it couldn't play well with the classic MacOS MMU-less handle-based memory management scheme.

pmarreck

a month ago

LuaJIT’s C FFI integration is super useful in a scripting language and I’ve replaced numerous functions previously written in things like Bash with it.

it also helps that it has ridiculously high performance for a scripting language

hnlmorg

a month ago

Lua only departs from norms if you’ve had a very narrow experience with other programming languages.

Frankly, I welcome the fact that Redis doesn’t use JavaScript. It’s an abomination of a language. The fewer times I need to use it the better.

spacechild1

a month ago

> it feels like it departs from what people know without good reasons.

Lua is a pretty old language. In 1993 the world had not really settled on C style syntax. Compared to Perl or Tcl, Lua's syntax seems rather conventional.

Some design decisions might be a bit unusual, but overall the language feels very consistent and predictable. JS is a mess in comparison.

> because it departs from a more Algol-like syntax

Huh? Lua's syntax is actually very Algol-like since it uses keywords to delimit blocks (e.g. if ... then ... end)

zeckalpha

a month ago

Redis' author also made jimtcl, so I don't think the lack of a small engine was the gap

lacoolj

a month ago

Normally I'd say "it's never too late!" but clearly would diverge and require an entirely new project, maintaining two bases for the same thing, etc.

Good to see you alive and kicking. Happy holidays

petters

a month ago

Lua having a JIT compiler seems like a big difference though. It was a while since that got major updates, but probably relevant at the time?

avaer

a month ago

What are the chances of switching to MQJS or something like it in the future?

TimTheTinker

a month ago

I for one would be would be very interested in a Redbean[0] implementation with MicroQuickJS instead of Lua, though I lack the resources to create it myself.

[0] https://redbean.dev/ - the single-file distributable web server built with Cosmopolitan as an αcτµαlly pδrταblε εxεcµταblε

simonw

a month ago

Clarification added later: One of my key interests at the moment is finding ways to run untrusted code from users (or generated by LLMs) in a robust sandbox from a Python application. MicroQuickJS looked like a very strong contender on that front, so I fired up Claude Code to try that out and build some prototypes.

I had Claude Code for web figure out how to run this in a bunch of different ways this morning - I have working prototypes of calling it as a Python FFI library (via ctypes), as a Python compiled module and compiled to WebAssembly and called from Deno and Node.js and Pyodide and Wasmtime https://github.com/simonw/research/blob/main/mquickjs-sandbo...

PR and prompt I used here: https://github.com/simonw/research/pull/50 - using this pattern: https://simonwillison.net/2025/Nov/6/async-code-research/

simonw

a month ago

Down to -4. Is this generic LLM-dislike, or a reaction to perceived over-self-promotion, or something else?

No matter how much you hate LLM stuff I think it's useful to know that there's a working proof of concept of this library compiled to WASM and working as a Python library.

I didn't plan to share this on HN but then MicroQuickJS showed up on the homepage so I figured people might find it useful.

(If I hadn't disclosed I'd used Claude for this I imagine I wouldn't have had any down-votes here.)

MobiusHorizons

a month ago

What is the purpose of compiling this to web assembly? What web assembly runtimes are there where there is not already an easily accessible (substantially faster) js execution environment? I know wasmtime exists and is not tied to a js execution engine like basically every other web assembly implementation, but the uses of wasmtime are not restricted from dependencies like v8 or jsc. Usually web assembly is used for providing sandboxing something a js execution environment is already designed to provide, and is only used when the code that requires sandboxing is native code not javascript. It sounds like a good way to waste a lot of performance for some additional sandboxing, but I can't imagine why you would ever design a system that way if you could choose a different (already available and higher performance) sandbox.

miki123211

a month ago

Since you're here and this is likely to become professionally relevant for me pretty soon, what is the best way you know of for securely running Python inside Python?

I was looking for something like Pyodide but runnable from Python, but that doesn't seem to exist quite yet. I can get a Python interpreter to run in wasmtime, but that doesn't have the Pyodide goodies like Micropip etc. Sadly, Pyodide itself seems fully married to JS, as it compiles to Emscripten and not WASI.

I'm almost tempted to just go with a small binary embedding V8 and running Pyodide inside V8 isolates or something.

(I know I can do this via Firecracker / GVisor / whatever, that is not the solution I'm looking for.)

zellyn

a month ago

I’m horribly biased but I think it’s a combination of: (1) knee-jerk reaction to similar-looking but low-value comments, and (2) most people not having played around with LLM coding agents and messed around with their own agents enough to immediately jump to excitement at simple, safe sandboxing primitives for that purpose.

And +1000 on linking to your own (or any other well-written) blog.

sublimefire

a month ago

Look at how others implement quickjs and restrict its runtime for sensitive workloads [1], should be similar.

But there are other ways, e.g. run the logic isolated within gvisor/firecracker/kata.

[1] github.com/microsoft/CCF under src/js/core

strbean

a month ago

Curious if you have a specific use case for sandboxed JS that you would share?

pizlonator

a month ago

This engine restricts JS in all of the ways I wished I could restrict the language back when I was working on JSC.

You can’t restrict JS that way on the web because of compatibility. But I totally buy that restricting it this way for embedded systems will result in something that sparks joy

groundzeros2015

a month ago

He already has a JS engine which doesn’t make these restrictions

andai

a month ago

> You can’t restrict JS that way on the web because of compatibility.

Well, now we can run this thing in WASM and get, I imagine, sane runtime errors :)

jacobp100

a month ago

Since you’re on the topic, what ever happened to the multi threading stuff you were doing on JSC? Did it stop when you left Apple? Is the code still in JSC or did it get taken out?

simonw

a month ago

If anyone wants to try out MicroQuickJS in a browser here's a simple playground interface for executing a WebAssembly compiled version of it: https://tools.simonwillison.net/microquickjs

It's a variant of my QuickJS playground here: https://tools.simonwillison.net/quickjs

The QuickJS page loads 2.28 MB (675 KB transferred). The MicroQuickJS one loads 303 KB (120 KB transferred).

azakai

a month ago

Looks like those sizes could be improved significantly, as the builds include names etc. I would suggest linking with

emcc -O3

(and maybe even adding --closure 1 )

edit: actually the QuickJS playground looks already optimized - just the MicroQuickJS one could be improved.

kamranjon

a month ago

I was interested to try Date.now() since this is mentioned as being the only part of the Date implementation that is supported but was surprised to find it always returns 0 for your microquickjs version - your quickjs variant appears to return the current unix time.

xigoi

a month ago

At last, I can run JavaScript in my browser. The world is now complete.

throwaway290

a month ago

The most important thing about any new JS runtime in 2025, how do I use it from JS? /s

ea016

a month ago

Well, as Jeff Atwood famously said [0], "any application that can be written in JavaScript, will eventually be written in JavaScript". I guess that applies to embedded systems too

[0] https://en.wikipedia.org/wiki/Jeff_Atwood

tacone

a month ago

Sounds a bit like rule 35 of the Internet.

vitaminCPP

a month ago

Please don't use js in medical devices.

timschumi

a month ago

It's unfortunate that he uploaded this without notable commit history, it would be interesting to see how long it takes a programmer of his caliber to bring up a project like this.

That said, judging by the license file this was based on QuickJS anyway, making it a moot comparison.

k4rli

a month ago

It does say "public repository of..." implying there's a non-public one with real history. Not sure why not upload the main one though.

user

a month ago

[deleted]

foresto

a month ago

I wonder if this could become the most lightweight way for yt-dlp to solve YouTube Javascript challenges.

https://github.com/yt-dlp/yt-dlp/wiki/EJS

(Note that Bellard's QuickJS is already a supported option.)

qbane

a month ago

Not likely:

> It only supports a subset of Javascript close to ES5 [...]

I have not read the code of the solver, but solving YouTube's JS challenge is so demanding that the team behind yt-dlp ditched their JS emulator written in Python.

AndyKelley

a month ago

That's a great idea, but if they did, then YouTube could retaliate by specifically using features that MicroQuickJS does not support.

leptons

a month ago

There's no reason it has to be lightweight, what it has to do is solve Youtube challenges without workarounds due to limited Javascript syntax.

silverwind

a month ago

Likely not, given that it only implements ES5.

MattGrommes

a month ago

I'm not an embedded systems guy (besides using esp32 boards) so this might be a dumb question but does something like this open up the possibility of programming an esp32/arduino board with Javascript, like Micro/Circuit Python?

cxr

a month ago

That's been possible with Moddable/Kinoma's XS engine, which is standards compliant with ES6 and beyond.

<https://www.moddable.com/faq#comparison>

If you take a look at the MicroQuickJS README, you can see that it's not a full implementation of even ES5, and it's incompatible in several ways.

Just being able to run JS also isn't going to automatically give you any bindings for the environment.

hebejebelus

a month ago

Sort of related: About ten years ago there was a device called the Tessel by Technical Machine which you programmed with Javascript, npm, the whole nine yards. It was pretty clever - the javascript got transpiled to Lua VM bytecode and ran in the Lua VM on the device (a Cortex M3 I believe). I recently had Claude rewrite their old Node 0.8 CLI tools in Rust because I wasn't inclined to do the javascript archeology needed to get the old tools up and running. Of course then I put the Tessel back in its drawer, but fun nonetheless.

matt_trentini

a month ago

It's a good _start_; much more code needs to be written to allow control of the hardware of those devices (GPIO, I2C etc).

15155

a month ago

Yes. The key enabling feature is a lack of malloc()

keepamovin

a month ago

Fabrice, Mr Bellard, O Indefatigable One, if you are reading this, I would love for you to make a JavaScript that compiles to assembly and works across Windows PE, macOS and Linux. Surrendering the various efficiencies of the V8 JIT bytecode in favor of AOT is entirely acceptable for the concision, speed and the chance to "begin again" that this affords. In fact, I believe you may already be working on such an idea! If you are not (highly doubtful) I encourage you to ponder it, and if we are so lucky and the universe wills it, you shall turn the hand of your incomparable craftsmanship upon this worthy goal, and doubtless such a magnificent creation shall be realized by you in a surprisingly short amount of time!

conoro

a month ago

As a long-time Espruino user I was immediately interested.

At first glance Espruino has broader coverage including quite a bit of ES6 and even up to parts of ES2020. (https://www.espruino.com/Features). And obviously has a ton of libraries and support for a wide range of hardware.

For a laugh, and to further annoy the people annoyed by @simonw's experiments, I got Cursor to butcher it and run as a REPL on an ESP32-S3 over USB-Serial using ESP-IDF.

Blink is now running so my work here is done :-)

  led.init(48)
  
  function blink() {
    led.rgb(0, 0, 255)
    setTimeout(function() {
      led.off();
      setTimeout(blink, 500)
    }, 500)
  }
  blink()

chunkles

a month ago

Timing really is everything for making the frontpage, I posted this last night and it got no traction.

self_awareness

a month ago

Some other guy tried it as well after you, also no luck.

One strategy is to wait for US to wake up, then post, during their morning.

Other strategy is to post the same thing periodically until there is response.

Wowfunhappy

a month ago

I suspect it's just random luck, not timing.

Reubend

a month ago

When reading through the projects list of JS restrictions for "stricter" mode, I was expecting to see that it would limit many different JS concepts. But in fact none of the things which are impossible in this subset are things I would do in the course of normal programming anyway. I think all of the JS code I've written over the past few years would work out of the box here.

MobiusHorizons

a month ago

I was surprised by this one that only showed up lower in the document:

- Date: only Date.now() is supported. [0]

I certainly understand not shipping the js date library especially in an embedded environment both for code-size, and practicality reasons (it's not a great date library), but that would be an issue in many projects (even if you don't use it, libraries yo use almost certainly do.

https://github.com/bellard/mquickjs/blob/main/README.md#:~:t...

ddtaylor

a month ago

Fabrice Bellard is widely considered one of the most productive and versatile programmers alive:

- FFmpeg: https://bellard.org

- QEMU: https://bellard.org/qemu/

- JSLinux: https://bellard.org/jslinux/

- TCC: https://bellard.org/tcc/

- QuickJS: https://bellard.org/quickjs/

Legendary.

groundzeros2015

a month ago

For all the praise he gets here, few seem interested in his methods: writing complete programs, based on robust computer science, with minimal dependencies and tooling.

rasz

a month ago

Funny how people know Fabrice for all the software stuff but none of the hardware antics:

played with implementing analog modem DSP in software in 1999 (linmodem is ~50-80% there, sadly never finished)

probably leading to

played with implementing SDR (again DSP) using VGA output to transmit DVB-T/NTSC/PAL in 2005

probably leading to

Amarisoft SDR 5G base station, commercial product started in 2012 - his current job https://www.amarisoft.com/company/about-us

justmarc

a month ago

Don't forget his LZEXE from the good old DOS days which was an excellent piece of work at the time.

PaulDavisThe1st

a month ago

Always interesting when people as talented as Bellard manage to (apparently) never write a "full-on" GUI-fronted application, or more specifically, a program that sits between a user with constantly shifting goals and workflows and a "core" that can get the job done.

I would not want to dismiss or diminish by any amount the incredible work he has done. It's just interesting to me that the problems he appears to pick generally take the form of "user sets up the parameters, the program runs to completion".

MontyCarloHall

a month ago

Whenever someone says there's no such thing as a 10x programmer, I point them to Fabrice and they usually change their mind.

vatsachak

a month ago

Don't forget his LLM based text compression software that won awards.

Guy is a genius. I hope he tries Rust someday

encom

a month ago

For all the praise he's receiving, I think his web design skills have gone overlooked. bellard.org is fast, responsive and presents information clearly. Actually I think the fancier the website, the shittier the software. Examples: Tarsnap - minimal website, brilliant software. Discord - Whitespacey, animation-heavy abomination of a website. Software: hundreds of MB of JS slop, government wiretap+botnet for degenerates.

The math checks out.

kallistisoft

a month ago

At this point I'm convinced that they're not a 'real person' and the 'Fabrice' is an operational code name for a very mature hacker collective.

Real people have to sleep at some point!

xgkickt

a month ago

Wikipedia doesn't list any honours awarded by the French Government. Nor do I see anything from ACM. Definitely overdue some official recognition.

bborud

a month ago

And that’s just his open source work.

didip

a month ago

For real. The GOAT is at it again!

c0brac0bra

a month ago

The first two links are broken.

aapoalas

a month ago

As a fellow (but way junior) JavaScript engine developer I'm really happy to see the stricter mode, and especially Arrays being dense while Objects don't treat indexed properties specially at all: it is my opinion that this is where we should drive JavaScript towards, slow and careful though it may be.

In my engine Arrays are always dense from a memory perspective and Objects don't special case indexes, so we're on the same page in that sense. I haven't gotten around to creating the "no holes" version of Array semantics yet, and now that we have an existing version of it I believe I'll fully copy out Bellard's semantics: I personally mildly disagree with throwing errors on over-indexing since it doesn't align with TypedArrays, but I'd rather copy an existing semantic than make a nearly identical but slightly different semantic of my own.

baudaux

a month ago

I easily managed to build quickJS to WebAssembly for running in https://exaequOS.com . So I need to do the same for MicroQuickJS !

MobiusHorizons

a month ago

I'm curious what practical purpose you could have for running a js execution engine in an environment that already contains a (substantially faster) js execution engine? Is it just for the joy of doing it (if so good for you, absolutely nothing wrong with that).

theandrewbailey

a month ago

> It compiles and runs Javascript programs with as low as 10 kB of RAM.

Just in time for RAM to become super expensive. How easy would it be to shove this into Chromium and Electron?

jraph

a month ago

Hard because of web compatibility.

The good news is that it would probably not matter much for chromium's memory footprint anyway...

booi

a month ago

If there were a software engineering hall of fame, I nominate Fabrice.

lacedeconstruct

a month ago

rare occasion where he gained a legendary status based purely on his work, I dont think I ever saw even a written interview with the guy

IlikeMadison

a month ago

Bellard it the most genius programmer to ever exist, and the least known compared to other pseudo stars.

textlapse

a month ago

His consistency and craftsmanship is amazing.

Being an engineer and coding at this stage/level is just remarkable- sadly this trade craft is missing in most (big?) companies as you get promoted away into oblivion.

wyldfire

a month ago

There is! ACM grants several awards for scientists and more.

One such award is the Turing Award [1], given "for contributions of lasting and major technical importance to computer science."

[1] https://en.wikipedia.org/wiki/Turing_Award

bArray

a month ago

If there were some form of "developed contributions to computing" award, his name is definitely up there. I think there could be a need for such an award - for people who reliably have created the foundations of modern computing. Otherwise it's almost always things from an academic context, which can be a little too abstract.

sxp

a month ago

Between ffmpeg and qemu, I always think of https://xkcd.com/2347/ when I see Fabrice's work. Especially since ffmpeg provides the backbone of almost all video streaming systems today.

mtlynch

a month ago

People talk about how productive Fabrice Bellard is, but I don't think anyone appreciates just how productive he is.

Here's the commit history for this project

b700a4d (2025-12-22T1420) - Creates an empty project with an MIT license

295a36b (2025-12-22T1432) - Implements the JavaScript engine, the C API, the REPL, and all documentation

He went from zero to a complete JS implementation in just 12 minutes!

I couldn't do that even if you gave me twice as much time.

Okay, but seriously, this is super cool, and I continue to be amazed by Fabrice. I honestly do think it would be interesting to do an analysis of a day or week of Fabrice's commits to see if there's something about his approach that others can apply besides just being a hardworking genius.

ronsor

a month ago

It's funny how many people replying here just got whooshed. This comment is satire; they don't actually think Bellard wrote everything in 12 minutes.

andoando

a month ago

Doesn't say much. Probably had it largely written down and put it together. I don't think it'd even be humanely possible to do that in 12 minutes.

tremon

a month ago

That doesn't mean anything. I quite often start with writing a proof-of-concept, and only initialize the git repository when I'm confident the POC will actually lead to something useful. Common sense says that those files already existed at the time of the first commit.

Lockal

a month ago

Glad to see a project of Fabrice Bellard on github, finally. I know many great opensource projects exist without public development (notably, sqlite), but is always disappointing to have no public bug tracker, no patch submission, no commit history, contact by email, tarballs (even with a signature, tooling for signed downloads never received any development), etc.

eichin

a month ago

Anyone know how this compares to Espruino? The target memory footprint is in the same range, at least. (I know very little about the embedded js space, I just use shellyplugs and have them programmed to talk to BLE lightswitches using some really basic Espruino Javascript.)

throwaway81523

a month ago

I haven't used Espruino but I spent a while perusing the source code. At least at the time, the implementation strategy was very slow. I lost interest in it in favor of Lua and Micropython.

yeasku

a month ago

I wonder if AI is so good why dont we have this kind of software released by people here who yap about it.

jgrizou

a month ago

What is the difference with https://www.espruino.com/ ?

sedatk

a month ago

They are very similar in terms of ROM footprint (esp: 128K vs mqjs: 100K) and min RAM (esp: 8K vs mqjs: 10K), but spec coverage need to be examined in detail to see the actual difference.

zamadatix

a month ago

On a phone at the moment so I can't try it out, but in regards to this "stricter mode" it says global variables must be declared with var. I can't tell if that means that's just the only way to declare a global or if not declaring var makes it scoped in this mode. Based on not finding anything skimming through the examples, I assume the former?

lioeters

a month ago

I'm guessing the use of undeclared variables result in an error, instead of implicitly creating a global variable.

MobiusHorizons

a month ago

it also talks about the global object not being a place to add properties. So how you might do `window.foo = ...` or `globalThis.foo = ...` to make something from the local context into a global object. in this dialect I guess you would have to reserve any global objects you wanted to set with a `var` and then set them by reference eg

    // global. initialized by SomeConstructor
    var fooInstance

    class SomeConstructor {
       constructor(...) {
          fooInstance = this;
       }
       static getInstance(...) {
          if (fooInstance != null) return fooInstance;
          return new SomeConstructor(...);
       }
    }

frabert

a month ago

I think it means you can't assign to unbounded names, you must either declare with var for global, or let/const for local

schappim

a month ago

Love it! Needing only 10K of RAM, it looks like a much better solution to CircuitPython (can squeeze into 32K).

noduerme

a month ago

>> Arrays cannot have holes. Writing an element after the end is not allowed:

    a = []
    a[0] = 1; // OK to extend the array length
    a[10] = 2; // TypeError
If you need an array like object with holes, use a normal object instead

Guess I'm a bit fuzzy on this, I wouldn't use numeric keys to populate a "sparse array", but why would it be a problem to just treat it as an iterable with missing values undefined? Something to do with how memory is being reserved in C...? If someone jumps from defining arr[0] to arr[3] why not just reserve 1 and 2 and inform that there's a memory penalty (ie that you don't get the benefit of sparseness)?

aapoalas

a month ago

Guidance towards correct usage: eg. If you allow `a[10] = 2` and just make the Array dense, the user might not even realise the difference and will assume it's sparse. Next they perform `a[2636173747] = 3` and clog up the entire VM memory or just plain crash it from OOM. Since it's likely that the small indexes appear in testing and the large indexes appear in production, it is better to make the misunderstanding an explicit error and move it "leftwards" in time, so that it doesn't crash production at an inopportune moment.

throwaway81523

a month ago

Old thread but I just saw it. My first question is whether it's sane to want to target Typescript or Purescript to it.

alcover

a month ago

I wish for this new year we reboot the Web with a super light standard and accompanying ecosystem with

    - A small and efficient JS subset, HTML, CSS
    - A family of very simple browsers that do just that
    - A new Web that adheres to the above
That would make my year.

qweqwe14

a month ago

This would never happen because there's zero incentive to do this.

Browsers are complex because they solve a complex problem: running arbitrary applications in a secure manner across a wide range of platforms. So any "simple" browser you can come up with just won't work in the real world (yes, that means being compatible with websites that normal people use).

cosmic_cheese

a month ago

Lots of comments talking about how existing browsers can already do this, but the big benefit that current browsers can't give you is the sheer level of speed and efficiency that a highly restricted "lite web" browser could achieve, especially if the restrictions are made with efficiency in mind.

The embedded use case is obvious, but it'd also be excellent for things like documentation — with such a browser you could probably have a dozen+ doc pages open with resource usage below that of a single regular browser tab. Perfect for things that you have sitting open for long periods of time.

born-jre

a month ago

There could be a way: This HTML-lite spec would be subset of current standard so that if you open this HTML lite page in normal browser it would still work. but HTML-lite browser would only open HTML-lite sites, apart from tech itch it could be used in someplace where not full browser is needed, especially if you are control content generation. - TV screens UI - some game engines embed chrome embed thing ( steam store page kind) - some electron apps / lighter cross platform engine - less sucky QML - i think weechat or sth has own xml bashed app froamework thing (so could be useful to people wanting to build everything app app platform - much richer markdown format ?

dcminter

a month ago

While we're wishing, can we split CSS into two parts - styling and layout? Also, I'd like to fix the spelling on the "referer" header...

duped

a month ago

I think there needs to be a split between the web browser as a document renderer and link follower, and the web browser as a portable target for GUI applications. But frankly my biggest gripe is that you need HTML, JS, and CSS. Three distinct languages that are extremely dissimilar in syntax and semantics that you need all three of (or some bastard cross compiler for your JSX to convert from one format to them). Just make a decent scripting language and interface for the browser and you don't need that nonsense.

I understand this has been tried before (flash, silverlight, etc). They weren't bad ideas, they were killed because of companies that were threatened by the browser as a standard target for applications.

hinkley

a month ago

Years ago I wrote a tiny xhtml-basic browser for a job. It was great. Some of my best work. But then the iPhone came out and xhtml-basic died practically overnight.

afavour

a month ago

So you want 2026 to be the year of Google AMP?

keepamovin

a month ago

Do it, man. Call it "MicroWeb" or whatever. Write an agent, make it "viewable with regular browsers". I think this could be cool.

aziis98

a month ago

I would actually merge html and js in a single language and bring the layout part of css too (something like having grid and flexbox be elements themselves instead of display styles, more typst kind of showed this is possible in a nice way) and keep css only for the styling part.

Or maybe just make it all a single lispy language

1313ed01

a month ago

Not likely to happen. There is geminiprotocol with gemtext though for those of us that are fine with that level of simplicity.

Work towards an eventual feature freeze and final standardisation of the web would be fantastic though, and a huge benefit to pretty much everyone other than maybe the Chrome developers.

GaryBluto

a month ago

Be the change you want to see in the world. If you want to use a specific subset of HTML, CSS and JS, go ahead, make a website using it and offer a browser for similar-spec sites.

speed_spread

a month ago

You can already create websites to these standards. Then truncate large parts of webkit and create a new browser. Or base it on Servo.

oefrha

a month ago

You mean like the piece of crap that was WAP?

mewse-hn

a month ago

I can't think of an instance of the web contracting like that. Maybe when Apple decided not to support Adobe Flash.

mromanuk

a month ago

Would be cool to create a MicroBrowser, just to browser stuff that's compatible.

fud101

a month ago

It needs a good standard library yeah? i don't see that in your list.

stronglikedan

a month ago

I mean, you can do all that now, so that's not the problem. The problem would be convincing millions of people to switch, when 99.99999% of them couldn't care less.

bArray

a month ago

And if you find you need more features than that - just build an app, don't make the web browser into some overly bloated app!

notorandit

a month ago

This guy is incredible. Lzexe, Qemu, TinyCC to name just a few gems.

itsangaris

a month ago

Is there a static analyzer/linter associated with this environment that can flag potential runtime issues upfront?

tracker1

a month ago

Sound like this would have been a good option for PLJS in PostgreSQL (currently using QuickJS), not sure if it'd be appropriate to consider a switch or if that would/could improve availability... IMO interaction with JSON(B) and other json and objects being the biggest usefulness.

t43562

a month ago

Sounds like a competitor for Micropython on all those little RP2350 and ESP boards.

aiddun

a month ago

Very excited about this. I was programming an ESP32 for a project recently and was like, computer chips are fast enough, why can't I just write TypeScript?

g947o

a month ago

Looks like the real "JavaScript: The Good Parts"

p0w3n3d

a month ago

I wonder when does he have time to do those marvellous things

mrmagoo17

a month ago

This is a hell of a Christmas present, Mr. Santa Bellard!

rurban

a month ago

And most importantly, it brought him out to interact with the public. He answered PR's!

yoan9224

a month ago

bellard is basically proof that the "10x engineer" exists. ffmpeg, qemu, quickjs, and now this... all from one person. the fact that he can optimize a js engine down to 10kb of ram is wild. would love to see this on esp32 boards

vkdelta

a month ago

What use-cases do you think it would help on esp32?

artemonster

a month ago

I wonder what "hurr durr gotos are bad" crowd would say. Anyone?

pvtmert

a month ago

This is going to be one of the most upvoted submissions on HN

dangoodmanUT

a month ago

this would be a killer replacement for micro/circuitpython for embedded devices, assuming there's an elegant TS->MQJS transpile

halfmatthalfcat

a month ago

It’s not even the languages or runtimes that inhibit embedded adoption but the software to hardware tooling. Loader scripts, HAL/LL/CMSIS, flashing, etc. They all suck.

curtisblaine

a month ago

I don't think you can transpile arbitrary TS in mqjs's JS subset. Maybe you can lint your code in such a way that certain forbidden constructs fail the lint step, but I don't think you can do anything to avoid runtime errors (i.e. writing to an array out of its bonds).

idle_zealot

a month ago

It looks like if you write the acceptable MQJS subset of JS+types, then run your code through a checker+stripper that doesn't try to inject implementations of TS's enums and such it should just work?

noreplydev

a month ago

how anyone explore extending the stdlib for hardware specific features?

rcarmo

a month ago

Now all we need is a Fennel-like LISP on top.

diimdeep

a month ago

I find frustrating that imagination of very smart, talented and capable people is captured by JavaScript language, surely they could have done better.