Live data from Hacker News

QuickJS JavaScript Engine

bellard.org

251–260 of 279 posts

Re: QuickJS JavaScript Engine

#251

Earlier quoted context omitted.

JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all elegant, so the programmer elite regard it with derision. I also notice people often conflate the problems of overzealous browser-based scripting with JavaScript the programming language. This is pretty understandable since JavaScript has been the only browser scripting option for 2 decades, but those problems would exist no matter what option…

> JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all elegant, so the programmer elite regard it with derision. I would love to find a language I consider more elegant than modern JS/TS. Haven't seen anything yet though. I also question your claim that it's the "elite" who regard JS with derision. Fabrice is presumably fine with it considering he spent valuable time writing an engine for it.

I don't think JS/TS is that bad, but it's certainly pretty far from elegant. TS adds decent type support which helps tamp down on dynamic complexity but rust, go, kotlin, c#, swift, ocml even java are all much more elegant languages. I realize that elegance is largely subjective so I won't belabor the point, but it's a pretty widely accepted subjective assessment.

Re: QuickJS JavaScript Engine

#252

I'm asking this here because I don't really know where else to do so: I'm trying to compile a binary from a js source that uses the standard modules (they are loaded by default if you run the interpreter) so the following works: std.printf("%d\n", 1); std.printf("%s\n", os.platform); However it does not compile to a binary and doing something like: import std from "std"; import os from "os"; std.printf("%d\n", 1); st…

import * as std from "std"; import * as os from "os"; std.printf("%d\n", 1); std.printf("%s\n", os.platform)

Awesome thanks!

Re: QuickJS JavaScript Engine

#254

Earlier quoted context omitted.

It seems to be relatively very fast in the space of small javascript interpreters meant for embedding. That's a different niche with different constraints.

But "embedding" is a very vague term. You can embed V8 too. It's just a C++ library, it can be linked into other programs. It can run on relatively small devices. If you're going to say, but what about even smaller devices than that then sure, maybe this implementation can squeeze into a certain class of rare device that can't run V8. But then why would such a constrained device be running JavaScript at all. That wou…

You certainly can embed V8, but it's a more involved affair. It's not the use case that's prioritized.

It's not at all my field of expertise, but my guess is that problems with V8 are that it's an order of magnitude larger, that it's written in C++ rather than C89, that it's more likely to make large changes to the way it works, and that it uses more memory.

All of those are good decisions to make for a component of Chrome that helps run webpages. But sometimes you'll only want to make it possible for users of your less than massive technical application to script its behavior using a language they might already be familiar with, and then those properties are undesirable.

"Quick" calls to mind something that's not just fast, but nimble.

Re: QuickJS JavaScript Engine

#255
post #96
post #25

Is there anything that Fabrice can't do? I mean, FFMpeg is almost a PhD thesis in and of itself, and he still manages to find time to make TinyC, QEMU, and now this. To say I'm jealous of his skills would be an understatement.

I have two question in my mind. 1. Are there anyone on HN knows him in real life? 2. Does anyone have other people in their mind who is in the same league as this man? Mike Pall's LuaJIT sort of make him at this level but that is only one thing. Fabrice create things that everyone are using it one way or another, and if it wasn't HEVC patents mess we would have his bpg [1] replacing jpeg. [1] https://bellard.org/bpg/

perhaps John von Neumann

Re: QuickJS JavaScript Engine

#256
post #243

Earlier quoted context omitted.

I have a domain-specific Windows application that uses Google's V8 engine for hosting user-written scripts. It hasn't been upgraded for several years, and when I recently took a look at updating the V8 version it's linked with, I was dismayed at how bloated and complex V8 has become. Seems like it can't be compiled down to a single DLL anymore, at least not without turning the compilation into a miniature research pr…

Thank you for your example! Does the the application basically pass data to a user script (the user knows JS so it is useful for them?), and then the JS returns the data after processed? Amusingly I asked the question and remembered that I actually worked on (supported) a hardware product that did this to some extent. It was a disaster as the scripting language would eat memory / cpu and crash the box ;)

Correct, the application acquires data from hardware and allows the user to access it from their own JavaScript code. This is useful for automated test, report generation, debugging, things like that. Crashing is bad for customer relations. :) V8 has performed well in that regard, no complaints there. I just don't see why it has to be so massive.

Re: QuickJS JavaScript Engine

#257
post #25

Is there anything that Fabrice can't do? I mean, FFMpeg is almost a PhD thesis in and of itself, and he still manages to find time to make TinyC, QEMU, and now this. To say I'm jealous of his skills would be an understatement.

How do you become like this?

Re: QuickJS JavaScript Engine

#258
post #217
post #204

Earlier quoted context omitted.

Richard Stallman is mostly known for his activist/politics stuff at this point, but he was also a heck of a developer. He wrote Emacs, GCC, GDB and glibc. I'm not sure if he was a total lone wolf, but my understanding is that in the early days he was overwhelmingly the main person responsible for those projects.

It's hard to get a sense of how smart RMS is, because he seems to be anti-showy about it. But I've seen him talk in different venues, and calibrate how much he says to the venue. I've also seen him ramp up how much detail he goes into, and what kinds of arguments he can make, when someone with a background in some area is challenging him on some point. I can't tell how smart he is, but I suspect that most people talk…

It hard to get a sense of how Smart RMS is, because he invents his own terms or he repurposes existing well understood terms (such as the term free) to confuse the issue.

It is something I have little respect for and tbh it doesn't matter how clever it is when he spends most of that effort on for want of a better term intellectual wankery.

Re: QuickJS JavaScript Engine

#259

Earlier quoted context omitted.

JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all elegant, so the programmer elite regard it with derision. I also notice people often conflate the problems of overzealous browser-based scripting with JavaScript the programming language. This is pretty understandable since JavaScript has been the only browser scripting option for 2 decades, but those problems would exist no matter what option…

> JS is the new PHP. It's really popular (i.e. lots of n00bs) and not at all elegant, so the programmer elite regard it with derision. I would love to find a language I consider more elegant than modern JS/TS. Haven't seen anything yet though. I also question your claim that it's the "elite" who regard JS with derision. Fabrice is presumably fine with it considering he spent valuable time writing an engine for it.

check out ocaml

Re: QuickJS JavaScript Engine

#260
post #144

Earlier quoted context omitted.

There are other bugs, too, like: 1420 th = js_mallocz(ctx, sizeof(*th)); 1421 th->has_object = TRUE; 1422 if (!th) { 1423 JS_FreeValue(ctx, obj); 1424 return JS_EXCEPTION; 1425 } But hey, that's gonna get ironed out. :)

This is still an important reminder that literally nobody in the world can write C code without memory issues. Even if the developer is a genius and the project isn't that big.

This one is probably easily catchable even by a static code analysis, though.

I suspect this is the result of th->has_object being added later than the surrounding code. I don't think someone would write this code on the first attempt with this bug. It's too obvious.

If the code repo ever becomes available, I'll check my theory out. :D

Post reply on HN