Hacker News new | ask | show | jobs
by ushakov 1022 days ago
Things that people often seem to forget about when talking about Bun:

  * Written Zig, an unstable programming language
  * Segfaults and crashes are common
  * Doesn’t work on windows (edit: fixed in v1)
  * The web-server is based on uWS, a third-party dependency maintained by one person
  * Vendor-specific APIs like Bun.serve, Bun.file, etc. You can call Node APIs in Bun, but you cannot call Bun APIs in Node
  * Tries to be everything at once: a bundler, a compiler, a package manager, a runtime, a testing framework, etc. 
  * A VC-baked effort. If the funds run dry there is no Bun anymore
5 comments

>You can call JS in Bun, but you cannot call Bun APIs in JS

This is confusingly worded, and I didn't understand what you were trying to say before I watched the video announcement.

"Bun" is a runtime, "JS" is a language that's implemented by multiple runtimes (including Bun, npm, and browsers). It makes no sense to say "you can't call the Bun APIs in JS" because calling them in JS is the only way to do it in the first place.

What you seem to mean is "you can't call Bun APIs from other runtimes" which is... kind of obvious? And also kind of an empty complaint, since Bun is primarily an npm replacement, and npm does the same thing[1]

[1] https://nodejs.org/api/fs.html

Pretty harsh take. The windows issue is a deal breaker true, but zig is a great language. One of the few languages that I would consider state of the art, favoring innovation instead of being a C copycat.
> For the first time, a native Bun build for Windows is available! Previously Windows users needed to use Windows Subsystem for Linux to use Bun. Not anymore.
> * Vendor-locked-in with proprietary APIs like Bun.serve, Bun.file, etc.

What does this mean? Every JS runtime (node, deno, bun etc.) has its own set of APIs and they are generally not cross-compatible. The code for all the Bun APIs is open source so I'm not sure what makes them proprietary.

> You can call JS in Bun, but you cannot call Bun APIs in JS

Bad use of terminology. JS is the language, JavaScript/ECMAScript, and every JS runtime (node, bun, deno etc.) is using it. So you definitely can call Bun APIs in JS.

The catch is that Node APIs are supported by Node, Deno and Bun. But not vice-versa, which makes them vendor-specific
That's not a big problem, e.g. if you are using a Bun API for speed or some other specific reason, you can always do:

    if (typeof Bun === "undefined") {
      // Node.js code
    } else {
      // Bun code
    }
If you are writing a lot of Bun-specific code, yeah that will only work on Bun ofc. But I like that now I can add some small snippets of bun-optimized code in my libraries.

Otherwise, normally you'd use ESM APIs > Node.js APIs > Bun APIs, like if you are hashing something, right?

In what sense are the Bun.* APIs "proprietary"? They're open source, no? If you want to port them to another language, it would be completely possible to.
For me, the most important missing part is the sandboxing.