Live data from Hacker News

The Bun Shell

bun.sh

181–190 of 239 posts

Re: The Bun Shell

#181
post #13

> We've implemented many common commands and features like globbing, environment variables, redirection, piping, and more. Of course on paper that sounds fine. However, something that is missing from here is some assurances of how compatible it actually is with existing shells and coreutils implementations. Is it aiming to be POSIX-compliant/compatible with Bourne shell? I am going to assume that not all GNU extensio…

> Is it aiming to be POSIX-compliant/compatible with Bourne shell?

No? It never claimed to be aiming to be POSIX-compliant. It seems like it's just making it easier to write "scripts", or do the equivalent of writing a script, in JS.

And if you're NOT using this, then you're also not guaranteed to have a POSIX-compliant shell since you may be on Windows, for example

Re: The Bun Shell

#182
post #103
post #22

Earlier quoted context omitted.

We implement a handful of the most common commands like cd, rm, ls, which, pwd, mv. Instead of using the system-provided ones, it uses ours. Unlike zx/execa, we have our own shell instead of relying on a system-installed one.

Think this should be highlighted in the article, because that's actually pretty cool but the article gave me impression that it's a simple sugar over child_process only.

I had the exact opposite impression, FWIW. I understood implicitly (assumed?) that it was implementing its own commands

Re: The Bun Shell

#183

Earlier quoted context omitted.

Cool project but it’s completely impossible to navigate back. Something on that page is spamming my browsers back button history

Strange, history is not used. Which browser are you using ?

I have the same back-button issues on both Firefox and Chrome (on linux if it matters) when going to this website. Multiple pages in history are e.g. just black screens.

Re: The Bun Shell

#184
Really cool. How would you use config files from other shells like .zshrc? We use direnv and mise to scope binary versions to project directories and just wondering how stuff like that would work.

Re: The Bun Shell

#185

Great, it's approaching the ergonomics of what Perl has offered for decades. And Perl still does it better.

Um, what? Perl in 2024 is just (far) worse Php. Or why just not use Python at that point?

I ... am not sure which of the three languages you're familiar with, but I don't think that's remotely correct.

perl has block based lexical scoping and compile time variable name checking.

python and PHP both have neither, which continues to make me sad because I actually -do- believe that explicit is often better than implicit.

perl has dynamic scoping (including for variables inside async functions using the newer 'dynamically' keyword rather than the classic 'local'), which I don't think PHP does at all and python context managers are -slowly- approaching the same level of features as.

perl gives you access to solid async/await support, a defer keyword, more powerful/flexible OO than PHP or python, and a database/ORM stack that really only sqlalchemy is a meaningful competitor to of those I've used in other dynamic languages.

Sure, if you're writing perl like it's still 2004, it -does- kinda suck. But so did PHP 4.

The "why not use" argument is probably better made with respect to modern javascript (I'm really enjoying bun when I have the choice and I can live with node when I don't), since "let" and "use strict;" give you -close- to the same level of variable scoping, plus usable lambdas (though the dynamic scoping still sucks, hence things like React context being ... well, like they are), and the modern JS JITs smoke most things performance-wise.

Oh, and a bunch of people who used perl for systems/sysadmin type stuff have switched to go, which also makes complete sense - but using python after using perl -properly- has a significant tendency to invoke "but where's the other half of the language?" type feelings, and I think that's only somewhat unfair.

(python is still awesome in its own right, and PHP these days is at least tolerable (and I continue to be amazingly impressed by the things people -write- in PHP), but "worse php" is just a -silly- thing to say)

NB: If anybody wants specific examples, please feel free to ask, but this comment already got long enough, I think.

Re: The Bun Shell

#186

Earlier quoted context omitted.

Tagged templates are really cool. They are a reasonably simple extension of template strings, which allow constructing strings very easily by allowing arbitrary code to be put inside a ${} block inside of template strings (ones that begin and end with backticks ` instead of single or double quotes). So if you think about it template strings are like a tagged template who's function just calls .toString() and concaten…

I just wish they had something like pythons triple quotes or here docs or c++ r strings. A single backtick makes it hard to use backticks inside the string

I especially like recent perls' support for (and everybody with a HERE doc implementation that doesn't have that yet should absolutely implement it, people who can't stand perl deserve access to that feature too ;)

Re: The Bun Shell

#187

In the .net world, we have a namespace called System.IO, that houses cross platform implementations of functions to work with directories, files, searching for files, can't we just have a standard js library in the same spirit, than try to half ass emulate a shell just so someone can run rm - rf. All of this seems extremely unnecessary and a wasted time and energy to solving the wrong problem.

The article starts by mentioning the programmatic interfaces, but the point here is to be better able to write quick, clear scripts, not full programs.

It's solving a -different- problem, and it may not be a problem that you personally have, but as I think the various excited comments rather demonstrate, it absolutely -is- a problem plenty of people -do- have and it's a really nice thing to have available for us.

Re: The Bun Shell

#188

Minor tangent, but plucked from that article, why is ‘rimraf’ downloaded 60m+ time a week?! Why is that a thing that need a library? (Asking as a systems guy, not a programmer)

Which languages have a recursive delete in their standard library, other than shell? Do any? HShell (see other comments) also implements its own rm() function because the JDK standard library is too low level to support something like that.

Re: The Bun Shell

#189
post #109

Earlier quoted context omitted.

Being in the Google GitHub org doesn't mean "by Google", it means "by someone who works at Google."

But doesn't he get paid by Google to code this?

Not necessarily. You can write open source code in your own time and publish under Google org on GitHub. This is the recommended process if you don’t care about retaining the copyright to your code.

If someone does want to retain copyright, there’s another process for getting approval.

Re: The Bun Shell

#190
post #112

Perl and Python already went through this path without much uptake.

I've seen quite a lot of "shell but in perl" and "shell but in python" in the wild, but also I think this is primarily aimed at "this particular utility that ships with $library would most naturally be a shell script but it's a lot more convenient overall to have a nice way to write something similar-ish-looking that shares the interpreter with everything else."

If nothing else it'll make development-side package.json commands easier and nicer, which is still IMO a net win.

Post reply on HN