Top
Best
New

Posted by ananas-dev 10 hours ago

UEFI Bindings for JavaScript(codeberg.org)
180 points | 94 commentspage 2
shevy-java 7 hours ago|
I think there are two philosophies here:

1) JavaScript must stay in the box (aka in the browser).

2) JavaScript as a general purpose programming language.

While I can absolutely understand 1), I have had wanted to access the filesystem via JavaScript, just as I do via ruby or python, for local use only. After I googled for a while, they would say that this is not possible unless one uses npm/node. I think this shows that there are use cases here and the "default" JavaScript, aka 1), does not cover these. I do not like JavaScript, but based on my own use cases, I actually favour 2) far more than 1). So from that point of view, being able to access UEFI can also be useful. So why not.

pwdisswordfishy 3 hours ago||
> I googled for a while, they would say that this is not possible unless one uses npm/node

Gnome Shell and Firefox/SeaMonkey/Mozilla Application Suite/Netscape 6+ (and Zotero[1]) are implemented on top of SpiderMonkey.

1. <https://news.ycombinator.com/item?id=46735616>

notpushkin 6 hours ago|||
> I have had wanted to access the filesystem via JavaScript, just as I do via ruby or python

There are some (limited) ways to do so now: https://developer.mozilla.org/en-US/docs/Web/API/File_System...

As for (1) vs (2), it’s not really an issue of JavaScript at all. The main question is, do you want to build something that runs in a browser? If you’re building a web app, you’ll have to use the sandboxed APIs (and probably JavaScript). If you don’t care about the runtime, yeah, you can use Node or Bun or Deno (or use another language altogether).

tracker1 2 hours ago|||
I've been using Deno a LOT for general shell scripting... it's been pretty nice in general. FWIW, Node, Bun and Deno have FS interfaces in the box, so yes, you can do it without npm modules. Though Deno allows you to directly reference the modules/repos from the script without needing a separate install step, package.json or node_modules directory.

It's also a single, self-updating executable and includes a lot in the box. Including SQLite3.

watermelon0 4 hours ago|||
You are missing one option:

0) JavaScript must be abolished from the browser

DJBunnies 6 hours ago||
Try webkitdirectory file attribute for browser access to the file system.
pwdisswordfishy 8 hours ago||
Does it manage to support floats? I am not sure if those can be safely used in the UEFI environment. (I recall GRUB’s build of Lua being integer-only, and Linux avoiding the use of floating-point arithmetic in kernel mode, but I don’t remember the reason.)
flopsamjetsam 5 hours ago||
Floating point was not supported in the Linux kernel to avoid having to save/restore FP registers.
monax 8 hours ago||
Yeah floats works
juancn 7 hours ago||
This is both so impressive and cursed that I'm not sure how to feel.
sanufar 8 hours ago||
This is hilarious lol, it’ll be any day now before we get a full JS kernel. Garbage collection could be an obstacle, but I know there have been some kernels written in Go/Java before
shepherdjerred 7 hours ago||
It could be even better!

https://en.wikipedia.org/wiki/Java_processor

fnimick 7 hours ago||
Who needs to garbage collect? Just leak memory until the system dies! That strategy seems to be good enough for claude code, anyway.
cluckindan 7 hours ago||
If it’s good enough for missile guidance systems, it’s good enough for me.
xp84 5 hours ago||
I don't have real context here, but I can imagine that a platform where the hardware costs millions of dollars, will be booted up in "Production" exactly once, and is guaranteed to be physically destroyed before it hits 1 day of uptime, just "Give it 128GB of RAM and YOLO (literally)" is great advice!

Note: 128GB of DRAM may add another million dollars to the build cost by 2027 at the current derivative of the $/GB curve

cluckindan 3 hours ago||
Context: https://devblogs.microsoft.com/oldnewthing/20180228-00/?p=98...
lioeters 8 hours ago||
Turning in the widening gyre, the falcon cannot hear the falconer. The center cannot hold.. The old prophecy is coming true.
raphaelmolly8 7 hours ago||
The choice of Duktape here is smart — it's one of the few JS engines that can actually run freestanding with minimal libc stubs, since it was designed for embedding in constrained environments. V8 or SpiderMonkey would be a nightmare to get running pre-boot.

What I find most interesting is the UEFI services binding approach. Rather than trying to abstract away the hardware, it exposes the raw EFI protocols (GraphicsOutput, SimpleFileSystem, etc.) directly to JS. That's a much more pragmatic design than trying to build a full HAL — you get to prototype UEFI applications rapidly while keeping the escape hatch to C for anything performance-critical.

Would love to see if anyone tries hooking this into UEFI's built-in network stack for PXE boot scripting. That could actually be useful beyond the novelty factor.

written-beyond 6 hours ago|
Are em-dashes really that common to use or did I just start noticing them after LLMs became popular for rewriting comments?

Not implying your comment is LLM generated, clearly it isn't but asking as a genuine question.

Kerrick 6 hours ago||
Pretty dang common. OS X and macOS (and maybe iOS and iPadOS, though I'm not certain) have been autocorrecting "--" into "—" for over a decade. Windows users have been using Alt codes for them since approximately forever ago: https://superuser.com/q/811318.

Typography nerds, which are likely overrepresented on HN, love both em dash and en dash, and we especially love knowing when to use each. Punctation geeks, too! If you know what an octothorp or an interrobang are, you've probably been using em dashes for a long time.

Folks who didn't know what an em dash was by name are now experiencing the Baader-Meinhof phenomenon en masse. I've literally had to disable my "--" autocorrect just to not be accused of using an LLM when writing. It's annoying.

geocar 6 hours ago|||
⌥- produces a – as well. That's sometimes easier than typing `--` and hoping for the best.
ziml77 1 hour ago||
That's an en-dash. You want to also hold shift to make it an em-dash.
xp84 6 hours ago|||
It really is. We dash-users are the real and most important victims of the AI revolution. I hope someday our story will be told (by the machines)
Decabytes 8 hours ago||
I’m always amazed and slightly envious of what programming languages with large developer bases can do. I mean if a language is Turing complete it can do anything, but JavaScript takes this to the extreme.

Mind you I never said anything about quality or performance, obviously doing everything in JavaScript comes with it’s own issues but if you were to say that someone got JavaScript running in the Linux kernel as a POC I wouldn’t even be surprised

fennec-posix 1 hour ago||
good. god.
vaylian 8 hours ago||
Could this be used as a learning tool? Rebooting the computer takes so much more time compared to reloading the browser tab. And you probably can't brick your computer.
fbnszb 9 hours ago|
Yeah, but your [developers] were so preoccupied with whether or not they could, they didn't stop to think if they should.
More comments...