Live data from Hacker News

Fabrice Bellard Releases MicroQuickJS

github.com

551–560 of 594 posts

Re: Fabrice Bellard Releases MicroQuickJS

#551
post #444

Earlier quoted context omitted.

> transparent switching between skins (about as easy as changing the tab sizes) One of my pet "not today but some day" project ideas. In my case, I wanted to give Python/Gdscript syntax to any & all the curly languages (a potential boon to all users of non-Anglo keyboard layouts), one by one, via VSCode extension that implements a virtual filesystem over the real one which translates back & forth the syntaxes during…

I want to do the opposite: Give curly braces to all the indentation based languages. Explicit is better than implicit, auto format is better than guessing why some block of code was executed outside my if statement.

Indentation is just as explicit as braces.

Re: Fabrice Bellard Releases MicroQuickJS

#552
post #215
post #133

Earlier quoted context omitted.

It wouldn't fix the issue of semantics, but "language skins"[1][2] are an underexplored area of programming language development. People go through all this effort to separate parsing and lexing, but never exploit the ability to just plug in a different lexer that allows for e.g. "{" and "}" tokens instead of "then" and "end", or vice versa. 1. https://hn.algolia.com/?type=comment&prefix=true&query=cxr%2... > 2. http…

One day Brython (python with braces allowing copy paste code to autoindent) will be well supported by LSPs and world peace will ensure

What editor are you using that does not have a way to paste code with proper indentation?

Re: Fabrice Bellard Releases MicroQuickJS

#553
post #205

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

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

Re: Fabrice Bellard Releases MicroQuickJS

#554

Earlier quoted context omitted.

There's nothing wrong with 1-based indexing. The only reason it seems wrong to you is because you're familiar with 0-based, not because it's inherently worse.

That's simply untrue. 1-based indexing is inherently worse because it leads to code that is less elegant and harder to understand. And slightly less efficient but that's a minor factor.

If a language has a well-designed collections library (think Smalltalk and derivatives, not C++'s STL), the difference between 1 and 0-based indexing is hard even to notice, much less lead to "less elegant" code. Between Stream and Collection subclasses, the API is rich enough that using indexes is reserved for very low-level operations that you seldom use in non-FFI, non-VM code.

What you say is true for languages that don't have collections, real arrays, or vectors, only memory ranges. This is the case of C, but not Fortran, Pascal, or Ada. So yeah, if all you have is a hammer, you'd better use 0-based nails; hopefully, though, we'll allow for non-hammer tools in popular toolboxes sometime this century.

Re: Fabrice Bellard Releases MicroQuickJS

#555
post #380

Earlier quoted context omitted.

I’m sure you are aware the sandbox that requires maintaining is v8 itself. Of course there are ways for the wrapper to break the sandbox by providing too much in thr global context, but short of that, which the application code could easily do as well, I don’t see why a wrapper should require significant resources to maintain beyond consuming regular updates from upstream. Is there some other reason you hold such a h…

None of those v8 solutions provide what I need: 1. The ability to restrict the amount of memory that the sandboxed code can use 2. The ability to set a reliable time limit on execution after which the code will be terminated My third requirement is that a company with real money on the line and a professional security team is actively maintaining the library. I don't want to be the first person to find out about any…

Gotcha I hadn’t factored those capabilities into the concept of sandbox, but I can see why they would be important features.

I will admit I don’t really understand why the library that wraps v8 requires a security team in your view, given that v8 itself definitely has one. I’m trying to understand what you see as the dangerous piece of such code likely to lead to exploits. I’m probably missing something, but I fail to see where the complexity lies.

Re: Fabrice Bellard Releases MicroQuickJS

#556
post #380

Earlier quoted context omitted.

None of those v8 solutions provide what I need: 1. The ability to restrict the amount of memory that the sandboxed code can use 2. The ability to set a reliable time limit on execution after which the code will be terminated My third requirement is that a company with real money on the line and a professional security team is actively maintaining the library. I don't want to be the first person to find out about any…

Gotcha I hadn’t factored those capabilities into the concept of sandbox, but I can see why they would be important features. I will admit I don’t really understand why the library that wraps v8 requires a security team in your view, given that v8 itself definitely has one. I’m trying to understand what you see as the dangerous piece of such code likely to lead to exploits. I’m probably missing something, but I fail t…

The biggest one is I don't want someone submitting malicious (or just poorly designed) code that crashes my server - hence the focus on memory and CPU limits.

I also need to limit filesystem access - don't want them stealing private files from elsewhere on the system, or filling the disk with garbage data (again causing a crash).

Network access restrictions are important too - I don't want my server becoming part of some DDoS attack, or an attacker using it to hit supposedly safe internal endpoints (SSRF).

Re: Fabrice Bellard Releases MicroQuickJS

#557
post #87

Earlier quoted context omitted.

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

Self-decompressing executables felt like magic to me at the time. Fantastic work, overall.

Reading about APE similarly sparkled me - the amount of ingenuity and sheer amazingness (if not perhaps a touch of depravity) that goes into these kinds of endeavors is awe inspiring.

Re: Fabrice Bellard Releases MicroQuickJS

#558

Earlier quoted context omitted.

Pascal. Modula-2. BASIC. Hell, Logo. Lately, yes, Julia and R. Lots of systems I grew up with were 1-indexed and there's nothing wrong with it. In the context of history, C is the anomaly. I learned the Wirth languages first (and then later did a lot of programming in MOO, a prototype OO 1-indexed scripting language). Because of that early experience I still slip up and make off by 1 errors occasionally w/ 0 indexed…

As I understand it Julia changed course and is attempting to support arbitrary index ranges, a feature which Fortran enjoys. (I'm not clear on the details as I don't use either of them.)

There was no change of course. Julia's AbstractArray interface requirements are just agnostic about array start indices. we have packages (e.g. OffsetArrays.jl) for arbitrary index ranges and that has existed for a long time.

If anything, the only significant change is that the community is becoming more and more convinced that offset array support is a bit of a footgun and makes it easy for bugs to sneak into generic code.

Re: Fabrice Bellard Releases MicroQuickJS

#559

Earlier quoted context omitted.

Is Bellard the “Chuck Norris” of Programming?

He is extremely productive in its specialty: the intersection of programming language and system programming. I don't think that makes him superhuman. It's more a model of what a really talented person who applies themselves building things they enjoy building can do. I prefer thinking of it this way: if Bellard can make a small JS engine from scratch by himself, what's really stoping you from knocking down this libr…

> He is extremely productive in its specialty: the intersection of programming language and system programming.

Why do you say that specifically is his specialty? He also started QEMU and ffmpeg which are foundational pieces of software for several industries, and his day job is as founder of a company that makes software defined radio test equipment for cellular networks. There isn't one thing I could point at as a specialty.

Re: Fabrice Bellard Releases MicroQuickJS

#560

Earlier quoted context omitted.

>Lua is the only lightweight language that I am aware of with TCO. Scheme is pretty lightweight.

Which scheme implementation? Guile?

For a functionnal language, TCO is really a must have. How would you do the equivalent of loops without it ?
Post reply on HN