News for hackers. Stuff that matters.
Re:Bun 1.2 Is Released by Cthulhu_ on Thursday January 23, 2025 @03:58AM (#42802133)
Why are they putting 3rd party (databases) and external (s3) librares into their core / std lib? Wouldn't that be better as an optional library? I think a runtime like this should be very, very careful with what they put into the std lib, adding these already makes it feel like a kitchen sink project.
Re:Bun 1.2 Is Released by jbergstroem on Thursday January 23, 2025 @04:15AM (#42802235)
I think this position is also one of the reasons it gained attention. Batteries included is a popular and chosen route for many.
Re:Bun 1.2 Is Released by nsonha on Thursday January 23, 2025 @04:24AM (#42802291)
nothing wrong with that, but why putting it on a global object instead of a built-in module. Better yet, that module may be publishable on jsr/npm
Re:Bun 1.2 Is Released by viraptor on Thursday January 23, 2025 @04:29AM (#42802329)
> Setting up typescript can be hard.

Node just enabled it by default. You still need the dev dependency for manual compilation and checks, but at runtime it should "just work". https://nodejs.org/en/blog/release/v23.6.0

Re:Bun 1.2 Is Released by Shacklz on Thursday January 23, 2025 @05:05AM (#42802526)
As enthusiastic as I am about node's typescript-support, calling it "just works" is a bit of a stretch. Not entirely sure if it's still the case anymore on the latest versions but last I checked it was required to use `.ts`-suffixes for all the imports, something a standard typescript project will hardly ever have and needs to be specifically configured to be considered valid syntax (allowImportingTsExtensions:true).

But yeah, there's progress, and once this gets solid traction (which I'm sure it will) it might finally be the last drop in the bucket to convince TC39 to stop being so antagonistic to having some notion of type-support directly in Javascript.

Re:Bun 1.2 Is Released by re-thc on Thursday January 23, 2025 @04:55AM (#42802484)
> but at runtime it should "just work"

Maybe when it doesn't use WASM and there's proper integration. Otherwise it's just like npm and people still need to look for alternatives.

Re:Bun 1.2 Is Released by homebrewer on Thursday January 23, 2025 @04:30AM (#42802339)
Which means they did not learn from Python's mistakes. You need to look further than the next couple of years. For some reason during the past 10 years or so it has become fashionable to throw away everything the industry has learned in decades prior and start anew, repeating the same mistakes. We'll never turn into proper engineering with such attitude.

https://lwn.net/Articles/776239

https://lwn.net/Articles/888043

https://lwn.net/Articles/790677

Re:Bun 1.2 Is Released by libwithttl on Thursday January 23, 2025 @05:20AM (#42802597)
This doesn't seem like a mistake other than how it is the obvious lead to the scope creep, maintenance creep pipeline. Python having an highly capable standard lib is exactly why some people love it, specially "10 years ago" when it was very slow to rev up your machines that need to be very much isolated from other machines, and you just had to have a bright enough person on systems making sure everything was included from the get go. Python saved the ass of more than 0 people reading this discussion right now on that merit alone.

I think there's a simple solution to all this. Libraries targeting third party protocols get an expiration date and have to forcefully be replaced by name after a given number of versions. Even if they keep the same underlying code, still change the name to force developers to look up its usage and legacy. How many versions? However many equates to the threshold you use to call most systems "legacy". I don't mind some job security and some timebomb punishment aimed at dinosaurs. I have bigger and more consistent issues with that than with weter or not C++ let's me crack a .rar without extra libs.

Re:Bun 1.2 Is Released by spiffytech on Thursday January 23, 2025 @08:05AM (#42803585)
> during the past 10 years or so it has become fashionable to throw away everything the industry has learned in decades prior and start anew

This is a curious take to me. I've spent the last 10 years seeing people claim again and again that if JS just had common stuff built in like <other lang>, we wouldn't have all this library churn, node_modules bloat, and left-pad silliness. That the mistake was not including a standard library.

Re:Bun 1.2 Is Released by notnullorvoid on Thursday January 23, 2025 @03:00PM (#42807473)
This is mostly a sentiment I see from people who used or heard of JS 10+ years ago and didn't bother to learn added JS language features and recent tooling.

Standard libs can be great, but they should really be reserved for baseline features, especially in a language like JS where all changes must be backward compatible. The standard JS has now is not at all what it was in the early 2010s, it's a very good set of baseline features.

Re:Bun 1.2 Is Released by flohofwoe on Thursday January 23, 2025 @05:06AM (#42802528)
The opinionated batteries-included stdlib was exactly what made Python popular in the first place though (and even despite its 'weird' syntax). And tbh, most of the current problems were also only added in the Python 3.x era (e.g. 3.x looks very much like a 'second system' - https://en.wikipedia.org/wiki/Second-system_effect)
Re:Bun 1.2 Is Released by Rucadi on Thursday January 23, 2025 @05:19AM (#42802594)
Python's "mistakes" are my weapons in my restricted corporate production system.
Re:Bun 1.2 Is Released by poulpy123 on Thursday January 23, 2025 @05:10AM (#42802555)
Batterie-included is one of the main things that made python great and useful before it became big enough to not need it (don't know for bun).
Re:Bun 1.2 Is Released by e3bc54b2 on Thursday January 23, 2025 @05:00AM (#42802508)
I despise Python's tooling and never touch it willingly.

That said, Python's 'mistake' also made it one of the most used languages ever. For nearly 2 decades, you could just type `python` in terminal and get rolling, and that was invaluable.

The only real 'mistake' that Python did was breaking backwards compatibility so spectacularly that single greatest feature was rendered useless.

Re:Bun 1.2 Is Released by Yajirobe on Thursday January 23, 2025 @06:46AM (#42803081)
> single greatest feature was rendered useless.

Which feature are you referring to?

Re:Bun 1.2 Is Released by e3bc54b2 on Thursday January 23, 2025 @07:39AM (#42803388)
being able to type `python` and start writing a program that would work nearly everywhere.

With compatibility break there was a decade of confusion, even the simplest print statement wouldn't work. I understand there were real reasons to do all that, but it did cause damage.

Steve Yegge put it better than I can[0]:

> the thing is, every single developer has choices. And if you make them rewrite their code enough times, some of those other choices are going to start looking mighty appealing. They’re not your hostages, as much as you’d like them to be. They are your guests. Python is still a very popular programming language, to be sure — but golly did Python 3(000) create a huge mess for themselves, their communities, and the users of their communities’ software — one that has been a train-wreck in progress for fifteen years and is still kicking.

> How much Python software was rewritten in Go (or Ruby, or some other alternative) because of that backwards incompatibility? How much new software was written in something other than Python, which might have been written in Python if Guido hadn’t burned everyone’s house down? It’s hard to say, but I can tell you, it hasn’t been good for Python. It’s a huge mess and everyone is miserable.

[0] https://steve-yegge.medium.com/dear-google-cloud-your-deprec...

Re:Bun 1.2 Is Released by otabdeveloper4 on Thursday January 23, 2025 @12:15PM (#42805841)
> there were real reasons to do all that

No there weren't. It's just pure idiocy and incompetence.

Re:Bun 1.2 Is Released by e3bc54b2 on Thursday January 23, 2025 @01:11PM (#42806368)
Well, I would agree with you. But I'm no language designer nor maintainer. It could all be bollocks, but since I'm the ignorant one, they get benefit of doubt.
Re:Bun 1.2 Is Released by ubercore on Thursday January 23, 2025 @05:28AM (#42802641)
As most things do, it cuts both ways. Rust suffers from their very slow adoption of libraries into a standard library, imo.
Re:Bun 1.2 Is Released by recursivedoubts on Thursday January 23, 2025 @09:05AM (#42804119)
Re:Bun 1.2 Is Released by Ygg2 on Thursday January 23, 2025 @07:41PM (#42809486)
A thing can be both a mistake from maintainance perspective, but a great boon from user perspective, or even a horrible kludge from power user perspective.
Re:Bun 1.2 Is Released by pjmlp on Thursday January 23, 2025 @11:02AM (#42805215)
Batteries included mean wherever there is a fully compliant implementation, there is something available, even if it isn't the best solution in the galaxy.

Whereas the best solution in the galaxy might only work in a few selected planets, in other ecosystems without batteries.

I prefer batteries included, and not having a culture with a function per package.

Re:Bun 1.2 Is Released by synergy20 on Thursday January 23, 2025 @11:26AM (#42805407)
golang is also battery included which seems great. i hope lua can have something similar though smaller
Re:Bun 1.2 Is Released by nindalf on Thursday January 23, 2025 @12:39PM (#42806052)
I think their move away from a binary lock file to a text based lock file in this release makes this pretty clear - they shoot first and ask questions later. Any of those problems they've identified with the binary lock file are kinda obvious if you think about it for a bit. A strong indicator that you should think about it is that the popular languages with package managers (npm, ruby, rust) have text based lock files. The fact that the bun team didn't think about it and thought that binary was better because it was faster and no one had thought of this idea feels like hubris to me.

It's cool that they're doing the mainstream thing now, but it's something for them to think about.

Re:Bun 1.2 Is Released by BackBlast on Thursday January 23, 2025 @07:13PM (#42809355)
Or they think extensively about performance.

Regardless, the switch shows they pay attention and are willing to change.

Re:Bun 1.2 Is Released by supriyo-biswas on Thursday January 23, 2025 @04:04AM (#42802173)
This is for their managed offerings. The problem of VC backed software was always that there would be these integrations that'd try to provide something unique to it, or IOW, lock-in.
Re:Bun 1.2 Is Released by zaphirplane on Thursday January 23, 2025 @05:09AM (#42802547)
What’s the monetisation plan
Re:Bun 1.2 Is Released by timeon on Thursday January 23, 2025 @05:51AM (#42802767)
Since at least web2.0 I've been burned many times. So my default position on VC backed projects without clear monetization plan is that it is probably bait-and-switch.
Re:Bun 1.2 Is Released by shubhamjain on Thursday January 23, 2025 @04:35AM (#42802377)
Quite a lot of people have told Jared (Bun’s Author) the same thing, but his opinion is that Bun should have everything a basic project might need. Keeping it in core he can make it more optimized than it would be as third-party library.

It’s a misguided approach according to me. And I feel Jared has become way too ambitious. But what can I say, it’s his passion project.

Re:Bun 1.2 Is Released by animuchan on Thursday January 23, 2025 @05:03AM (#42802520)
I can understand this vision: it's neat to be able to just open a file and start making a program, without having to choose one of the 20 relatively popular Postgres client libraries available on npm.

From the engineering standpoint, sure, it's a disaster.

But it's also the lost magic of TurboPascal and friends, where you could just be immediately productive, with no dependencies, no external tooling, on an old computer gathering dust in the school library.

Re:Bun 1.2 Is Released by Raed667 on Thursday January 23, 2025 @08:39AM (#42803875)
> without having to choose one of the 20 relatively popular Postgres client libraries

They can easily provide official extensions/packages clearly namespaced and avoid all this mess. But I fear that they're more focused on a "headline-driven-development" approach, the more different from the status quo, the better

Re:Bun 1.2 Is Released by animuchan on Thursday January 23, 2025 @09:51AM (#42804592)
And it's successful! I've unironically learned about Bun on YouTube, and now am a happy user. :)

A set of "blessed" known good packages would be wonderful to have in any language, I wonder why it's not a thing.

Re:Bun 1.2 Is Released by Raed667 on Thursday January 23, 2025 @11:32AM (#42805469)
I'm wondering what made you switch ? I find the ubiquity of node very comforting, maybe I'm not seeing the argument that will convert me over ?
Re:Bun 1.2 Is Released by morcus on Thursday January 23, 2025 @11:56AM (#42805660)
Not the original commenter -

It has just been a pretty low effort drop in replacement for me. It's definitely not a complete game changer, but quick iteration is just that bit more convenient since it's faster and I don't need to remember all the flags I normally have for my setup (Typescript, .env file, etc...)

Re:Bun 1.2 Is Released by animuchan on Sunday January 26, 2025 @05:30AM (#42829208)
Not entirely switch, but so far I've been using bun for small side projects and it's been rewarding. There's a lot less project managing, some scripts can be just a single file with no dependencies, no package.json and no build chain.

Of the "batteries included" features, the `Bun.serve` web server and the `HTMLRewriter` HTML5 SAX API thing are very powerful, saving a lot of node_modules space.

Running TypeScript without a build step is neat. (I know there's `node --experimental-transform-types`, and it's great to see this feature propagated "upstream")

That said, for large established Node.js projects, I don't really see the pull to switch over to Bun. There's cost associated with it (for one, the built-in test runner works a bit differently, so if you're using `node --test` it'll require some fiddling)

Re:Bun 1.2 Is Released by wiseowise on Thursday January 23, 2025 @06:47PM (#42809229)
No, thanks. That’s what Kotlin does and it’s an absolute shitshow. I want ‘editor index.ts’ and start working instead of going shopping for something that should’ve been part of std.
Re:Bun 1.2 Is Released by meiraleal on Thursday January 23, 2025 @06:32AM (#42802997)
Being misguided or not, it is good to have different approaches, including the ones that doesn't work.
Re:Bun 1.2 Is Released by lioeters on Thursday January 23, 2025 @07:54AM (#42803502)
Bravo, let a hundred flowers bloom. May the best ones win, or at least prove themselves to be "worse is better".
Re:Bun 1.2 Is Released by gardenhedge on Thursday January 23, 2025 @06:09AM (#42802867)
I think it's great. There are already alternatives so makes sense for Bun to do its own thing
Re:Bun 1.2 Is Released by mythz on Thursday January 23, 2025 @12:01PM (#42805704)
It's one of the things I love about Bun, I now write any non-trivial stand-alone scripts with TypeScript which is capable of a lot of functionality without needing any config or to install any external packages.
Re:Bun 1.2 Is Released by bilater on Thursday January 23, 2025 @12:20PM (#42805887)
I like the batteries included option and would likely use it a lot. But not sure why they simply did not make a "batteries" package you could install on top of core and avoid the inevitable push back they knew they would get from this.
Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:32PM (#42809744)
Deno is doing this. I'm not sure if it's good or not tbh. Now I have to worry about std package version on top of deno ver. And if I'm going to install a random package, how am I sure std deno is the best? Maybe I should choose something else. Back to decision fatigue
Re:Bun 1.2 Is Released by Aeolun on Thursday January 23, 2025 @04:43AM (#42802422)
As long as it works and follows a consistent API, why would that be an issue?

I kinda like the idea of not having to import potentially very slow JS code to do things that I need in basically all my projects.

Re:Bun 1.2 Is Released by flohofwoe on Thursday January 23, 2025 @05:02AM (#42802513)
The interesting question is: Where do you draw the line? Should a HTTP server/client be in the stdlib? File access? String templating? And why not a window system, 3D API and UI wrapper?

IMHO a stdlib should mainly provide standardized interface types, but not necessarily the implementations behind those interfaces. But that's probably not a very popular opinion since it falls between the two existing options of having a very bare bones and a batteries-included stdlib ;)

Re:Bun 1.2 Is Released by jeswin on Thursday January 23, 2025 @05:25AM (#42802628)
> Wouldn't that be better as an optional library?

Totally agree.

In their words, "Bun aims to be a cloud-first JavaScript runtime. That means supporting all the tools and services you need to run a production application in the cloud". This doesn't give me a lot of confidence.

This particular design choice seems even worse than Node.

Re:Bun 1.2 Is Released by diggan on Thursday January 23, 2025 @08:46AM (#42803935)
> This particular design choice seems even worse than Node.

We could argue that it's worse/better, but in the end it's just different. NodeJS when it appeared had the vibe and "marketing" to be something lightweight, fast and event-driven (compared to the alternatives at the time at least), where the 3rd party ecosystem provided the tooling for what Bun now tries to bundle into their "all-in-one" tool.

We've seen the same cycle multiple times. Developers need flexibility to configure something so a flexible solution appears, everyone gets excited and starts migrating. Eventually, more developers are tired of the flexibility and don't understand why there are so many configuration-options, so eventually a "all-in-one" solution appears, everyone gets excited and starts migrating. Eventually, people need to be able configure more things so....

Re:Bun 1.2 Is Released by azemetre on Thursday January 23, 2025 @02:44PM (#42807327)
Just wait until they give preference to services that their VC benefactors are also supporting.
Re:Bun 1.2 Is Released by kyriakos on Thursday January 23, 2025 @05:30AM (#42802658)
it is a very bad idea. you start your project using the built in client libs, you are locked in to bun as js runtime. if the license changes you are stuck.
Re:Bun 1.2 Is Released by SwiftyBug on Thursday January 23, 2025 @05:45AM (#42802735)
Not only that, but when the new hot JS runtime inevitably drops, it's going to be a pain to move to that.
Re:Bun 1.2 Is Released by culi on Thursday January 23, 2025 @05:53PM (#42808912)
What "new hot JS runtimes" are you talking about? Node has been pretty stable for over a decade and a half. This is the first time that anything is even challenging that place. It just so happens that both Bun and Deno efforts started around the same time and now have to compete with each other

I think any competent company would be savvy enough to avoid lock in for a technology with adoption this low. I don't think that's what these features are aiming for. I think they're aiming for the young dev starting side projects that wants to get up and running quick. Or imagine teaching a bootcamp class and you want a tool that will do some magic for you so you can focus on explaining other complex aspects of web development

Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:24PM (#42809699)
You don't think they're trying to lock us in? What's their big monetization plan then? I think they want us to drink the Kool aid. I don't have a problem with it though because I'm small enough that I can still refactor the world in a few days if I really need to.
Re:Bun 1.2 Is Released by skwee357 on Thursday January 23, 2025 @05:39AM (#42802697)
AFAIK bun is VC backed, so they need to make money at some point, therefore a speculation:

They want to make bun an all in one runner in order to vendor lock you in somehow. But I might be wrong. It indeed does not make sense to put such dependencies in the core/std lib

Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:30PM (#42809734)
I think that's the plan too. But I'm still not fussed about it. At the end of the day, it's still a great tool for getting stuff done and one less decision I have to make.

Also.. I don't quite know how they're going to lock me in unless they mess with the license. I can deploy my own bun server anywhere, no? I'd be stuck on bun I guess but still not paying anything.

Re:Bun 1.2 Is Released by sod on Thursday January 23, 2025 @05:59AM (#42802810)
Those packages exist already though. Pretty sure the bun maintainers (or Ciro Spaciari in this case) asked the question "how fast could it be if written in zig?".
Re:Bun 1.2 Is Released by izietto on Thursday January 23, 2025 @07:22AM (#42803278)
Isn't it possible to write it in Zig as a separate extension? Every mature language I'm aware of supports this AFAICT
Re:Bun 1.2 Is Released by culi on Thursday January 23, 2025 @05:54PM (#42808916)
Tree shaking means it won't bother you if you don't use it
Re:Bun 1.2 Is Released by ksec on Thursday January 23, 2025 @07:28AM (#42803309)
>Wouldn't that be better as an optional library?

It would be better if the libraries were not the most optimal or good enough. In bun's case it is not just the minimal they are basically making everything as good as it can be.

Re:Bun 1.2 Is Released by rakatata on Thursday January 23, 2025 @07:30AM (#42803325)
s3 is pretty much a de-facto standard, just like json like or not. Postgres also makes sense, it is the most widespread and community-liked db. What is the point of "optional libraries" tbh? It was a PITA in PHP back in the days and very inconvenient, prob most devs would prefer this way.

I feel like HN is on cognitive dissonance, they complain JS projects having too many dependencies and they also complain now when things are more integrated into the runtime because it increases vendor-lock and few extra megabytes (actually kilobytes according to the devs) to the binaries :/.

Lastly, big companies also prefer less dependencies, it is not just devs.

Re:Bun 1.2 Is Released by chearon on Thursday January 23, 2025 @12:20PM (#42805886)
It probably looks very wrong to people who still think lots of "modularity" and small packages is a good thing.

I'm all for it, and lots of Bun APIs are purely practical. Bun.stringWidth, for example, exposes code Bun already has internally. Nodejs probably has the same thing, but instead of us being able to use it, it gets reimplemented in 10 different versions in node_modules. How is that better?

I doubt the Bun team will have to change the S3 code very much over the years. The test runner, bundler, Postgres client, sure, I can see those being harder to maintain. But I'm also tired of everyone assuming everything needs to change all of the time. DX aside, my team is still on Webpack and we've only needed one new feature from it in the last ~5 years. Why can't Bun's bundler reach maturity and only receive a few updates?

Re:Bun 1.2 Is Released by pfg_ on Thursday January 23, 2025 @03:59PM (#42807998)
Node does have the same thing, and you can access it with `--expose-internals` from `const { getStringWidth } = require("internal/util/inspect");`. They don't expose it for some reason.
Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:22PM (#42809690)
I'm also still using webpack. Not sure why the community abandoned it. Haven't had any issues. Everything seems to use babel under the hood anyway and they all have their little wrappers over top.
Re:Bun 1.2 Is Released by Ygg2 on Thursday January 23, 2025 @07:53PM (#42809549)
> s3 is pretty much a de-facto standard

So was XML before, and SGML before it. De-facto changes over time, and backwards compatibility means your decisions are cast in stone.

In 20 years, you could see s3 being abandoned for newer formats, but bun will have to keep those packages.

Re:Bun 1.2 Is Released by 7bit on Friday January 24, 2025 @06:19PM (#42817890)
So? I mean, what ist the real downside, beside 5kb additional filesize?
Re:Bun 1.2 Is Released by Ygg2 on Saturday January 25, 2025 @12:37PM (#42823117)
Assuming backwards compatibility.

Ongoing maintenance burden. Ever increasing API, mistakes set in stone, subpar performance or properties.

"Standard library is where libraries go to die." exists as a saying for reason.

Re:Bun 1.2 Is Released by paulddraper on Thursday January 23, 2025 @08:15PM (#42809660)
> s3 is pretty much a de-facto standard

Finding documentation on that standard (particularly the edge cases) is very difficult

Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:19PM (#42809673)
Back in what days of PHP? I've been using PHP and MySQL since... Probably 2003ish and never had a problem. I think you need the extension but most providers had it.
Re:Bun 1.2 Is Released by sergiotapia on Thursday January 23, 2025 @10:58AM (#42805188)
that's old school javascript mentality. new school is bake it all in and let people get to work on the interesting bits.
Re:Bun 1.2 Is Released by h1fra on Thursday January 23, 2025 @11:10AM (#42805264)
I'm sure in the short term people will be happy, but maintaining that in the long run is a footgun. I can't see a team big enough to achieve that correctly, especially the bug confusion (e.g: is it bun or the 3rd party issue) that will creep on the main repo.
Re:Bun 1.2 Is Released by jatins on Thursday January 23, 2025 @11:26AM (#42805408)
I think it makes it easy to provide paid hosted services later if needed.

Hypothetical example: S3 client built in, enable a flag and now get a dashboard seeing analytics around file downloads, download latencies etc

Just pure hypothesis on my end given they have to make money somehow at some point

Re:Bun 1.2 Is Released by culi on Thursday January 23, 2025 @05:46PM (#42808864)
I don't like it either but in practice it doesn't really matter. Tree-shaking means those unused features won't affect your project
Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Thursday January 23, 2025 @08:26PM (#42809717)
Except that you can't shake built-ins. It's in the bun binary.
Re:Bun 1.2 Is Released by 7bit on Friday January 24, 2025 @06:21PM (#42817911)
So? IT wont affect performance. Dont call the library and ITS egfectively unused Code in the binary.
Re:Bun 1.2 Is Released by 8n4vidtmkvmk on Saturday January 25, 2025 @02:17PM (#42823854)
I'm not the one complaining. I'm just saying this has nothing to do with tree-shaking.