News for hackers. Stuff that matters.
Re:Show HN: tere – A Faster Alternative to cd+ls by enriquto on Friday July 15, 2022 @05:42AM (#32106392)

    curl https://raw.githubusercontent.com/mgunyho/tere/master/Cargo.lock | grep source | wc -l
    51
How come that such a simple tool has more than half a century of dependencies? This is terrifying.
Re:Show HN: tere – A Faster Alternative to cd+ls by scrollaway on Friday July 15, 2022 @06:43AM (#32106760)
The "too many dependencies" meme is far too often an example of Chesterton's Fence.

The answer to your question "How come a simple thing is more complex than I first thought?" is: "Because you've spent less time thinking about it than the author".

Re:Show HN: tere – A Faster Alternative to cd+ls by nonameiguess on Friday July 15, 2022 @10:23AM (#32108499)
This isn't true, though. If this had been an older GNU utility, the dependencies likely would have been libterm and libc. Not because it would have been less complex, but because of the ecosystem choice in C applications to have larger, fully-featured libraries versus the micro-libraries Rust seems to have inherited from JavaScript conventions.

Whether this is better or worse seems to be a matter of contention for a lot of people, but it certainly poses a challenge for supply-chain auditing. I suspect for Rust to truly ever replace C++ in its domain, the ecosystem is going to need to come up with something like boost so you can grab one library that does all the things nearly any program wants (regex, serialization, cli opts, etc) but that don't get included in the core language's stdlib.

Re:Show HN: tere – A Faster Alternative to cd+ls by nibbleshifter on Friday July 15, 2022 @11:48AM (#32109352)
> If this had been an older GNU utility, the dependencies likely would have been libterm and libc.

Yes, but then you are stuck with glibc + kitchen sink and GNU code quality, which is atrocious.

Re:Show HN: tere – A Faster Alternative to cd+ls by saagarjha on Friday July 15, 2022 @12:40PM (#32110022)
Atrocious but exceptionally battle-tested?
Re:Show HN: tere – A Faster Alternative to cd+ls by nibbleshifter on Friday July 15, 2022 @02:05PM (#32111077)
It was the best option a long while ago, and basically resulted in a kind of vendor lock in of sorts.

Musl is far superior as a libc, but most Linux software is written for glibc and has quirks that make porting hard.

Re:Show HN: tere – A Faster Alternative to cd+ls by alerighi on Friday July 15, 2022 @06:07PM (#32113291)
Musl is liked since it has a non-copyleft license and thus can be used to produce statically-linked executable that are distributed with proprietary licenses. Also Musl is smaller than GLibc thus more suitable for embedded systems.

Anyway, GLibc is just better, both in terms of performance (algorithms are more optimized, at the cost of a bigger executable size) and in terms of available features.

Re:Show HN: tere – A Faster Alternative to cd+ls by enriquto on Friday July 15, 2022 @06:33PM (#32113482)
> Musl is liked since it has a non-copyleft license

Not only for that. As much as I love copyleft, I'm really happy that musl exists so that I can easily test my programs locally for portability. Compiling stuff with different compilers and libraries exposes at once all sorts of weird bugs before you get to publish your codes.

Re:Show HN: tere – A Faster Alternative to cd+ls by saagarjha on Friday July 15, 2022 @03:12PM (#32111741)
> Musl is far superior as a libc

Nope. It’s better at some things but with so many caveats that this is just dumb to claim.

Re:Show HN: tere – A Faster Alternative to cd+ls by avgcorrection on Friday July 15, 2022 @03:06PM (#32111694)
Doesn’t C come out of that weird do-one-thing-and-do-it-well culture?
Re:Show HN: tere – A Faster Alternative to cd+ls by pessimizer on Friday July 15, 2022 @12:50PM (#32110142)
I don't think you can cite Chesterton's Fence for something that is 5 minutes old and lightly used. The Chesterton's Fence meme is far too often an excuse for baselessly dismissing criticism.
Re:Show HN: tere – A Faster Alternative to cd+ls by scrollaway on Friday July 15, 2022 @01:00PM (#32110263)
This project is 7 months old with almost 800 commits.

The comment I replied to is less than 100 characters long plus a command line invocation.

One of these two has spent more time thinking about whether some dependencies are needed.

Re:Show HN: tere – A Faster Alternative to cd+ls by mgunyho on Friday July 15, 2022 @06:13AM (#32106560)
I tried to avoid bloat as much as possible, and I would argue that the non-transitive deps are pretty essential. I'l look into tweaking some features as suggested in sibling to trim it further down.

But you're right that it could always be simpler, in fact I wrote tere originally in C with curses as the only dependency, and it compiles >10x faster. But there I had to manually write some (pretty certainly buggy) unicode handling, and I think adding extra features (proper arg parsing, json for history file etc) would be way more painful.

Re:Show HN: tere – A Faster Alternative to cd+ls by capdeck on Friday July 15, 2022 @02:04PM (#32111068)
I disagree with "bloat" comments. First, the binary will only have stuff you use. Secondly, the fact that you are not writing from scratch code that someone else had more time to write and test - this is a huge plus. I'd use your implementation any day vs. something that someone could put together in C with no dependencies and remarkable pointer math equilibristics.

As long as the use of dependencies remains reasonable, the number of dependencies does not immediately mean that the code is "bloated".

Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @09:29AM (#32107970)
I wonder, have you considered D? Seems almost ideal to me for this kind of small tooling, and it's unlikely to break because of dependency version changes caused by the thirty-seventh party.
Re:Show HN: tere – A Faster Alternative to cd+ls by mgunyho on Friday July 15, 2022 @10:01AM (#32108302)
Not really. The main reason for choosing Rust was to try it out, because it's the new cool thing. And I do find it really enjoyable. Rust is also trying very hard to keep dependency-related breakage to a minimum, and I think the Cargo ecosystem is doing a great job at that.
Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @10:07AM (#32108369)
Fair enough; "I wanted to try out X" is always a valid reason. It's just that compared to C, things like Unicode support, argument parsing and JSON support are already part of D's standard library so no dependencies should be required for those.
Re:Show HN: tere – A Faster Alternative to cd+ls by cillian64 on Saturday July 16, 2022 @04:43AM (#32116245)
> unlikely to break because of dependency version changes caused by the thirty-seventh party.

With rust you just check in your Cargo.lock file to your VCS and then the versions of your dependencies and their dependencies (etc) are pinned, so if it works now then it will always work. For dependencies on crates.io authors don’t even have the option to remove a version once it’s published.

Upgrading dependencies is an explicit operation, so you only do it when required and run your tests afterwards.

In practice I’ve had far fewer issues with dependency versions using rust than I’ve had using dynamic system libraries in the C/C++ ecosystem

Re:Show HN: tere – A Faster Alternative to cd+ls by nicoburns on Friday July 15, 2022 @04:09PM (#32112222)
Rust is also unlikely to break because of dependency version changes caused by the thirty-seventh party. Despite similarly large dependency trees, the Rust ecosystem takes backwards compatibility much more seriously than e.g. the JavaScript ecosystem.
Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @04:22PM (#32112344)
Well, I should hope so. Nevertheless every dependency removed completely removes even the possibility of such breakage.
Re:Show HN: tere – A Faster Alternative to cd+ls by nicoburns on Friday July 15, 2022 @04:27PM (#32112398)
I mean sure, but it means you have to maintain that functionality yourself. Often DIY implementations are not as robust as the versions in battle tested libraries with lots of eyes. So you can easily end up with more problems overall.
Re:Show HN: tere – A Faster Alternative to cd+ls by res0nat0r on Friday July 15, 2022 @10:28AM (#32108546)
Cargo.lock is the wrong place to be looking, there really are only 7 direct dependencies, https://github.com/mgunyho/tere/blob/master/Cargo.toml#L14-L...

The deps for each of these packages is really out of the authors hands, this is really the same for any programming language though which need to pull in dependencies of their own.

Re:Show HN: tere – A Faster Alternative to cd+ls by bscphil on Friday July 15, 2022 @12:10PM (#32109601)
That's true, but OP did ask a question "How come...". Your answer is that the Rust ecosystem is to blame for encouraging micro-dependencies, like Node.js, and not the author. I think that's a pretty reasonable take! But it doesn't mean that there's not a problem.
Re:Show HN: tere – A Faster Alternative to cd+ls by topspin on Friday July 15, 2022 @02:45PM (#32111475)
Code reuse was once considered a virtue.
Re:Show HN: tere – A Faster Alternative to cd+ls by geodel on Friday July 15, 2022 @06:43PM (#32113537)
Agree. That's why I will never re-write function is-Thirteen() when a battle-tested reusable package exists in NPM exactly for this.
Re:Show HN: tere – A Faster Alternative to cd+ls by fbanon on Friday July 15, 2022 @07:55AM (#32107165)
Well, that's Rust for you. They somehow think that having a boatload of dependencies with nondescript names (smawk, parking_lot_core, serde, clap - I feel like I'm having a stroke) is a feature. I'm not even joking.
Re:Show HN: tere – A Faster Alternative to cd+ls by hu3 on Friday July 15, 2022 @12:21PM (#32109742)
The aggressive replies on this thread. holy s**t.

That's what I mean when I say Rust community is toxic here https://news.ycombinator.com/item?id=32105449

Re:Show HN: tere – A Faster Alternative to cd+ls by cillian64 on Saturday July 16, 2022 @04:52AM (#32116287)
The comment would probably do better if it was phrased more like “Rust projects usually have lots of dependencies, and a lot of them have unhelpful names, and this is bad because XYZ”. This comment isn’t trying to offer constructive criticism or add to the discussion, it is just mocking rust and its users. The tone makes me a lot more likely to downvote it and move on rather than engaging in discussion.

For context, I totally agree that rust often ends up with more dependencies than I would like and that crate names are often super unhelpful, but I downvoted the comment.

Re:Show HN: tere – A Faster Alternative to cd+ls by avgcorrection on Friday July 15, 2022 @03:09PM (#32111727)
Snottily states that the Rust community loves having too many dependencies and that the cutesy names are stroke-inducing. And you think the replies to that are aggressive?
Re:Show HN: tere – A Faster Alternative to cd+ls by fbanon on Monday July 18, 2022 @08:14AM (#32137360)
Agreed. The Rust community took a disappointing direction in the past few years...
Re:Show HN: tere – A Faster Alternative to cd+ls by omni on Friday July 15, 2022 @09:22AM (#32107895)
Serde is a common term meaning "serialization/deserialization," seems pretty descript to me.
Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @10:31AM (#32108581)
You're saying it's "a common term", but I'd literally never heard it before a Rust library with this exact name appeared. Isn't this by any chance circular reasoning? That it became "a common term" because of this library? In that case you couldn't justify the name of the library by saying that it was "a common term" at that time.
Re:Show HN: tere – A Faster Alternative to cd+ls by scubbo on Friday July 15, 2022 @11:14AM (#32108995)
My $0.02 - I've heard of it and I've never worked in Rust, though calling it "a common term" seems like a bit of a stretch - I was over 5 years into my career before I encountered it. It's much less common than analogous terms like modem ("modulator-demodulator").
Re:Show HN: tere – A Faster Alternative to cd+ls by omni on Friday July 15, 2022 @02:32PM (#32111353)
I can assure you this Rust library did not invent the term

https://trends.google.com/trends/explore?date=all&geo=US&q=s...

Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @03:29PM (#32111877)
Sadly all I'm constantly getting is "429. That’s an error."
Re:Show HN: tere – A Faster Alternative to cd+ls by ac29 on Friday July 15, 2022 @04:57PM (#32112732)
Re:Show HN: tere – A Faster Alternative to cd+ls by jhgb on Friday July 15, 2022 @05:38PM (#32113095)
This is a different namespace though. Nothing to do with data structures. Also, ends with an 's'.
Re:Show HN: tere – A Faster Alternative to cd+ls by Cthulhu_ on Friday July 15, 2022 @10:48AM (#32108748)
But... what and how does it serialize/deserialize?
Re:Show HN: tere – A Faster Alternative to cd+ls by wongarsu on Friday July 15, 2022 @11:15AM (#32109007)
Approximately everything, but on its own nothing. Serde provides the framework and macros/annotations, serde_json is the "backend" implementing the actual json serialization.

Sure, it could be named serde_framwork and serde_json, but I think serde and serde_json isn't that bad either.

Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @08:47AM (#32107551)
I don't mind the number of dependencies, but I agree that the cutesy naming is ridiculous and obfuscating
Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @11:01AM (#32108877)
You're free to create your own project with your own name and have it compete on the free market for dominance. I don't get this criticism at all. Sure, it could be simpler, but it's A. Not your project, so who are you to say how to name it and B. Rust developers clearly understand what they're used for considering they're popular enough to be brought up here.

And unless you're actively developing in Rust, why would some other people's choice of naming their projects in a language and tool chain you don't ever plan on using be such a big deal?

Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @11:26AM (#32109115)
You can say this about literally any criticism ever. I hate it and it blows chunks. It is the ultimate libertarian way of striking down any discussion: do not criticise, even in any small way, because it's a free market and you can just make another one, so never EVER even THINK of discussing anything.

I'm not saying that there should be some kind of totalitarian regime that enforces naming, I'm simply saying that yeah it kinda sucks that Rust devs tend towards cutesy names over ones that convey functionality.

This just seems like you're getting weirdly offended for no reason. Not everything is some kind of attack on individual agency. There is absolutely nothing wrong with me remarking on the state of Rust naming. The fact that you are conflating it to be a "big deal", which I never said it was, just seems like bad faith arguing me. This is just not something to get so offended over.

Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @11:30AM (#32109156)
> I'm simply saying that yeah it kinda sucks that Rust devs tend towards cutesy names over ones that convey functionality.

Are you using Rust? If not, why does it matter what they choose to name their libraries. This is my entire point, you're coming in as an outsider criticizing something that is clearly not a problem to Rust devs.

If actual Rust developers are using them to the point where they're popular enough to gain (unwarranted, imo) criticism, then clearly they're working, silly name and all.

It's almost as if people care more about what the function a package provides rather than its name.

Re:Show HN: tere – A Faster Alternative to cd+ls by geodel on Friday July 15, 2022 @06:57PM (#32113633)
Why the hell one has to use Rust to comment on library name? Is there some license requirement for comments on Rust stuff? It's not like that people go on GitHub and tell authors that their project names are silly and need to be changed.

This is exactly cultish thing about Rust, that unless someone is praising Rust, they are free to keep their mouth shut.

Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @11:43AM (#32109296)
I'm not an outsider, I have used rust before, though not extensively, not that this matters at all. An active rust developer has no more permission to criticise something about the rust ecosystem than someone new to rust
Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @11:48AM (#32109342)
But it does matter. If the people actively using the packages aren't complaining, then there isn't really a problem.

You've hyperfocused so much on my "criticism of your criticism" and the permissibility behind it that you chose to ignore the actual criticism I laid down.

I'm not continuing this either way since I've said my piece. Maybe step back and actually read my comments rather than focusing on me criticizing your critique.

Also, pot calling the kettle black. You spent an entire comment being offended over my critique.

Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @11:53AM (#32109404)
You probably shouldn't make such inflammatory comments on an account that is directly linked to your professional and personal profiles, it really doesn't look great

Also it isn't a criticism of my criticism, it is an assertion that I should not be allowed to criticise at all, which is a totally different thing. Of course I am going to call that out

EDIT: I can't reply because rate limited

Please calm down. I'm not threatening you. I'm simply surprised that you make such inflammatory and aggressive comments on an account that is so closely tied to your professional life, that is all. I think you should reconsider doing so

Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @12:06PM (#32109546)
Oh so you jump to implicitly threatening those you disagree with? Wow. At least you made it clear how open you are to discussion and debate.

I never said you can't criticize. As the other commenter already said, you're allowed to critique but don't be surprised when your criticism is then critiqued itself. That's the epitome of modern discussions and debate.

I gave you examples of what you can do right now, aka making your own alternative packages, but you chose to ignore that all and double down on "don't you dare critique my criticism".

And then (I'm going to point this out again because it's so absurd) vaguely implied my comments would face professional retribution. Because I chose to disagree with you and make that public.

In any case, I said I'm stopping and I am. You should too, as you're already crossing several lines with this comment.

Re:Show HN: tere – A Faster Alternative to cd+ls by mxben on Friday July 15, 2022 @11:36AM (#32109214)
> do not criticise

Nobody said that. Of course you can criticize. But be aware that your criticism itself could be subject to criticism.

Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @11:44AM (#32109307)
That's not really what's going on here though, because it isn't counter criticism, or a response to the criticism, but is instead simply "you shouldn't get to criticise"
Re:Show HN: tere – A Faster Alternative to cd+ls by saagarjha on Friday July 15, 2022 @12:43PM (#32110060)
Don't Rust crates go in a global namespace? In that case using up common or short names is definitely something I get to care about.
Re:Show HN: tere – A Faster Alternative to cd+ls by daptaq on Friday July 15, 2022 @11:14AM (#32108992)
At the very least it would be nice if languages could separate the interface from weird (I guess the idea is that they should be fun?) library names.
Re:Show HN: tere – A Faster Alternative to cd+ls by bowsamic on Friday July 15, 2022 @05:48AM (#32106425)
Some Rust dependency bloat is pretty common, because a lot of idiomatic approaches are hidden behind dependencies. I don't think it's particularly crazy in this situation. The actual dependencies directly used are relatively lean:

crossterm = "0.24.0"

dirs = "4.0.0"

regex = "1.5.4"

serde_json = "1.0"

serde = { version = "1.0", features = ["rc"] }

textwrap = "0.14"

unicode-segmentation = "1.7"

I guess one could write their own textwrap and probably also dirs, but other than that they all are probably vital to this tool.

The only reason this wouldn't be a problem in another language would be because that language already includes the functionality of such libraries

Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Friday July 15, 2022 @06:22AM (#32106618)
You missed clap for the CLI because it was written in table form:

  [dependencies.clap]
  version = "3"
  default-features = false
  features = ["wrap_help", "suggestions", "std"]
Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Friday July 15, 2022 @05:53AM (#32106452)
`cargo tree` output:

  tere v1.0.0
  ├── clap v3.0.10
  │   ├── bitflags v1.3.2
  │   ├── indexmap v1.8.0
  │   │   └── hashbrown v0.11.2
  │   │   [build-dependencies]
  │   │   └── autocfg v1.1.0
  │   ├── os_str_bytes v6.0.0
  │   │   └── memchr v2.4.1
  │   ├── strsim v0.10.0
  │   ├── terminal_size v0.1.17
  │   │   └── libc v0.2.126
  │   └── textwrap v0.14.2
  │       ├── smawk v0.3.1
  │       ├── terminal_size v0.1.17 (*)
  │       ├── unicode-linebreak v0.1.2
  │       │   [build-dependencies]
  │       │   └── regex v1.5.4
  │       │       ├── aho-corasick v0.7.18
  │       │       │   └── memchr v2.4.1
  │       │       ├── memchr v2.4.1
  │       │       └── regex-syntax v0.6.25
  │       └── unicode-width v0.1.9
  ├── crossterm v0.24.0
  │   ├── bitflags v1.3.2
  │   ├── libc v0.2.126
  │   ├── mio v0.8.4
  │   │   ├── libc v0.2.126
  │   │   └── log v0.4.14
  │   │       └── cfg-if v1.0.0
  │   ├── parking_lot v0.12.1
  │   │   ├── lock_api v0.4.7
  │   │   │   └── scopeguard v1.1.0
  │   │   │   [build-dependencies]
  │   │   │   └── autocfg v1.1.0
  │   │   └── parking_lot_core v0.9.3
  │   │       ├── cfg-if v1.0.0
  │   │       ├── libc v0.2.126
  │   │       └── smallvec v1.8.0
  │   ├── signal-hook v0.3.13
  │   │   ├── libc v0.2.126
  │   │   └── signal-hook-registry v1.4.0
  │   │       └── libc v0.2.126
  │   └── signal-hook-mio v0.2.3
  │       ├── libc v0.2.126
  │       ├── mio v0.8.4 (*)
  │       └── signal-hook v0.3.13 (*)
  ├── dirs v4.0.0
  │   └── dirs-sys v0.3.6
  │       └── libc v0.2.126
  ├── regex v1.5.4 (*)
  ├── serde v1.0.134
  ├── serde_json v1.0.75
  │   ├── itoa v1.0.1
  │   ├── ryu v1.0.9
  │   └── serde v1.0.134
  ├── textwrap v0.14.2 (*)
  └── unicode-segmentation v1.8.0
I can easily look at each one of these and understand why it’s there, save only a few: most of crossterm’s recursive dependencies, which are fairly involved but the immediate dependencies at least are clearly explained in its README (and you could probably remove one or two of them at minor performance or similar costs); mio’s use of log, which I believe should be optional and I would say not enabled by default, but I’d rather use it with log than miss out on it, where it’s useful; uses of autocfg, which are build-time implementation detail for taking advantage of rustc features where available and readily understood on analysis; and I was going to say cfg-if, which I have a minor personal vendetta against due to extensive unnecessary use, but after looking at parking_lot_core’s src/thread_parker/mod.rs I will begrudgingly admit this is one of the rare cases where it is fairly well-justified. All up, none of the dependencies are in any way unreasonable.

Having over fifty dependencies for something like this is not in any way terrifying—you’re just starting with a different set of expectations and understandings of how things are done. It’s a natural and reasonable outworking of (a) using the right tools for the job, (b) doing things properly rather than half-heartedly (most obviously where terminal interactions are involved), and (c) Rust’s deliberately thin standard library.

Re:Show HN: tere – A Faster Alternative to cd+ls by reaperducer on Friday July 15, 2022 @09:44AM (#32108115)
hashbrown, smawk, corasick, parking_lot, itoa, ryu

Writing in Rust looks like casting spells in an Infocom game.

Gnusto rezrov!

Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @10:58AM (#32108846)
Really? itoa is one of your "magic incantations"?

https://en.m.wikibooks.org/wiki/C_Programming/stdlib.h/itoa

I get the others, but that ones a pretty standard type converter, the opposite of the C standard atoi

Re:Show HN: tere – A Faster Alternative to cd+ls by nicoburns on Friday July 15, 2022 @04:15PM (#32112275)
In fairness, C standard library functions mostly look like magic incantations to me (I think due in large part to the old-school convention of abbreviating function names). malloc, sprintf, atoi, etc don't exactly read like english... (unless you happen to already know what they stand for)
Re:Show HN: tere – A Faster Alternative to cd+ls by mgunyho on Friday July 15, 2022 @11:03AM (#32108893)
Also, aho-corasick comes from the name of this algorithm that is named after its inventors https://en.wikipedia.org/wiki/Aho%E2%80%93Corasick_algorithm
Re:Show HN: tere – A Faster Alternative to cd+ls by enriquto on Friday July 15, 2022 @11:03AM (#32108894)
What is the point of this function? In rust, there's no equivalent to sprintf?
Re:Show HN: tere – A Faster Alternative to cd+ls by mynameisvlad on Friday July 15, 2022 @11:07AM (#32108935)
https://doc.rust-lang.org/std/fmt/

Different tools for the same job. One is explicitly integer to string conversion the other is sting formatting.

You can technically use the latter, but some prefer a function which explicitly does one thing and one thing only.

Re:Show HN: tere – A Faster Alternative to cd+ls by pie_flavor on Friday July 15, 2022 @02:20PM (#32111232)
More accurately, some prefer a function that is statically dispatched and does not talk to std::fmt::Formatter.
Re:Show HN: tere – A Faster Alternative to cd+ls by MichaelCollins on Friday July 15, 2022 @12:10PM (#32109592)
atoi is a classic example of the sort of bad naming C has long been infamous for. It's not a word, it's an initialism, and the common documentation for it doesn't even say what the initialism actually means. It's relatively easy to infer what it means from the description of what it does (ascii to integer), but can easily be incorrectly inferred ([character] array to integer.)

C kind of gets a pass for this stuff because C was old and in the early days they were limited by token size. But to still be using this term today in a new language seems fairly derisible.

Re:Show HN: tere – A Faster Alternative to cd+ls by jonnycomputer on Friday July 15, 2022 @10:37AM (#32108639)
I don't know much about Rust, but I have a hard time believing python's standard library wouldn't have all the required functionality covered (whether performance would be adequate is different question). I for one, really really like python for its comprehensive standard library.
Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Friday July 15, 2022 @11:59AM (#32109475)
No, actually. Of the direct dependencies, Python’s standard library has equivalents of regex (re), serde/serde_json (json), clap (argparse) and the boring half of textwrap (textwrap, which is only suitable for ASCII, and possibly curses providing a buggy and incomplete version of Unicode- and column-awareness, but I’m not sure of even that much, and I don’t think it’s properly cross-platform either), and some parts of crossterm (curses, of uncertain availability and reliability). But it completely lacks equivalents of most of crossterm and textwrap, and all of dirs and unicode-segmentation, providing in the latter two cases only functionality pretty much exactly equivalent to what Rust’s standard library contains.

This is the sort of thing that I meant by “doing things properly rather than half-heartedly”. You could make something like this by reimplementing half the libraries in an inferior fashion, full of bugs, cross-platform inconsistencies and missing functionality. Or you can take an extra dependency. Even in Python, the recommendation would be firmly to add dependencies like appdirs for dirs and I dunno what for the rest.

Re:Show HN: tere – A Faster Alternative to cd+ls by wongarsu on Friday July 15, 2022 @11:11AM (#32108970)
Yes, Rust has a very different philosophy to the standard library. As soon as something enters the standard library its API is basically set in stone, since there's no versioning for the standard lib. As a consequence, Rust choses to keep a lot of "must-have" functionality in crates, where it can evolve and compete. (rather than just adding more and more HTTP clients to the standard lib like Python did :) )
Re:Show HN: tere – A Faster Alternative to cd+ls by mxben on Friday July 15, 2022 @11:37AM (#32109226)
> As soon as something enters the standard library its API is basically set in stone

Is that really all that different from Python?

Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Friday July 15, 2022 @11:46AM (#32109332)
No, that’s the point: if you put this stuff in the standard library, it gets frozen forever, and that’s why Rust doesn’t.
Re:Show HN: tere – A Faster Alternative to cd+ls by infinityio on Friday July 15, 2022 @12:42PM (#32110043)
To quote the python developers guide:

> Because of Python’s conservative nature when it comes to backwards-compatibility, when a module is added to the stdlib its API becomes frozen.

So it sounds like they do do something fairly similar, but just a different mindset on adding libraries

Re:Show HN: tere – A Faster Alternative to cd+ls by nibbleshifter on Friday July 15, 2022 @11:52AM (#32109387)
Python is "batteries included", Rust isn't. Different design choices entirely.

You can do a lot with pythons stdlib, and a lot of popular libraries (requests, for example) largely are just usability wrappers for underlying stdlib stuff.

Whereas with Rust, you have a very minimal std, and things you want to achieve are imported specifically.

Re:Show HN: tere – A Faster Alternative to cd+ls by mixmastamyk on Friday July 15, 2022 @02:11PM (#32111137)
requests is a wrapper around urllib3, which re-implements quite a bit.
Re:Show HN: tere – A Faster Alternative to cd+ls by sayanarijit on Friday July 15, 2022 @10:52AM (#32108778)
As long as there's no need to ship standalone binaries without shared libraries.
Re:Show HN: tere – A Faster Alternative to cd+ls by mgunyho on Friday July 15, 2022 @11:04AM (#32108906)
Indeed, Python would be a good language to implement this in terms of ease of development, but it's very difficult to distribute a standalone binary (which I wanted to do). The built-in curses support of Python is also not cross-platform I think.
Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Friday July 15, 2022 @12:12PM (#32109620)
It’s a funny thing I’ve noticed about scripting languages: they’re generally easier to get going with yourself, but they’re horrible for distribution/deployment, and if you have to integrate code written in other languages (even C libraries with Python bindings, or similar—things like wxWidgets or GTK), that rapidly escalates to a nightmare. Meanwhile, ahead-of-time compiled languages like Rust and Go are simply a breeze to distribute/deploy.
Re:Show HN: tere – A Faster Alternative to cd+ls by mgunyho on Friday July 15, 2022 @12:23PM (#32109764)
That's true, although I think in the case of Go, it is a central design decision to make single-binaries easy so it's more of an exception to the rule.

I don't think it's an inherent feature of scripting languages that they are hard to distribute. I'm pretty sure it's possible to package up a tiny Lua interpreter (or e.g. QuickJS) and all necessary scripts into a standalone file.

Re:Show HN: tere – A Faster Alternative to cd+ls by sayanarijit on Friday July 15, 2022 @02:39PM (#32111405)
Lua is only a configuration language without luarocks. With luarocks, we're back to the root of the argument - dependency vs standard library.
Re:Show HN: tere – A Faster Alternative to cd+ls by mixmastamyk on Friday July 15, 2022 @02:21PM (#32111244)
There are several working options for packaging Python apps, some existing for twenty years. Sure, while a little more complicated than compiling a static executable, it is hardly a "nightmare." It's basically writing a config file, and adding another stanza to a Makefile or modern equivalent.

Reminds me of the idea regularly pushed here that you need a virtualenv even for thirty-line scripts. I read these kind of takes here often and am a bit baffled by them. Maybe it is because developers have lost administrator skills over time, that this feels like an insurmountable challenge?

Re:Show HN: tere – A Faster Alternative to cd+ls by chrismorgan on Sunday July 17, 2022 @09:12AM (#32126466)
I’ve worked with several of those ways of distributing Python apps over the years, mostly under Windows with a little under Linux and macOS, and mostly around a decade ago now, though I’ve touched a very little non-Windows stuff in the last year or two. They’ve consistently been more work than they seem even if all your stuff is pure Python, and there are just caveats left, right and centre. All kinds of stuff that should be fundamental and built-in was just extra effort at every step. Hooking up resources in the .exe file, controlling the Windows subsystem stuff, adding a manifest that works, figuring out which MSVCRT redistributables you need and how to hook them up (and you can’t pretty much just couldn’t automate this in any way), finding what library files (.dll, .so, whatever) you need because of dynamic linking, fixing library.zip stuff that just mysteriously didn’t work for some libraries, special-casing stuff here and there for C dependencies, tweaking optimisation and compression levels to try to speed things up and shrink them since startup is unreasonably slow and the distribution unreasonably large but these tweaks are also inconsistent and often break things, adding files your program depends on in a place where they’ll work, tweaking your code because it runs differently under py2exe or py2app or pyinstaller or whatever, trying to figure out why what you’ve built just isn’t even starting on so-and-so’s machine…

Granted, a few of these things apply to Rust stuff as well (e.g. resources and manifests can’t quite be done out of the box without extra tools), but most of them are inapplicable, and the remainder tend to have better solutions than I observed in Python-land. And a lot of the pain that I’m describing of the Python stuff isn’t that it’s hard to do anything, but more that I’ve found it all just exceptionally error prone and unreliable.

Re:Show HN: tere – A Faster Alternative to cd+ls by sayanarijit on Friday July 15, 2022 @02:46PM (#32111480)
That static executable will basically contain the whole python interpreter with a huge standard library. Maybe makes sense for a gui app, but I'd avoid installing a whole python interpreter for each of my little cli tools.

Don't forget the startup time overhead of first loading a whole interpreter into memory, then loading a python program into the interpreter.

Re:Show HN: tere – A Faster Alternative to cd+ls by mixmastamyk on Friday July 15, 2022 @02:54PM (#32111563)
There are multiple options for these requirements as well. I understand that solutions are sometimes clumsy, but the end-user won't know the difference.
Re:Show HN: tere – A Faster Alternative to cd+ls by nibbleshifter on Friday July 15, 2022 @11:54AM (#32109407)
Standalone Python apps as binaries tend to be poorly performant, and huge (due to shipping an interpreter, stdlib, deps, etc) in my experience.

Assuming you get it working at all.

Re:Show HN: tere – A Faster Alternative to cd+ls by jonnycomputer on Friday July 15, 2022 @03:07PM (#32111702)
I'd prefer an informative rebuttal if people disagree with nibbleshifter, because I want to learn.
Re:Show HN: tere – A Faster Alternative to cd+ls by nibbleshifter on Saturday July 16, 2022 @07:17AM (#32116973)
I'm also kind of hoping someone comes along and says I'm wrong with a solution that doesn't suck tbh.
Re:Show HN: tere – A Faster Alternative to cd+ls by avgcorrection on Friday July 15, 2022 @06:42AM (#32106751)
Why don’t you suggest dependencies that could be removed? Oh right. That would require effort.
Re:Show HN: tere – A Faster Alternative to cd+ls by zaptheimpaler on Friday July 15, 2022 @08:11AM (#32107269)
> This is terrifying.

I recommend either CBT or writing your own version with fewer dependencies to ease your terror.

Re:Show HN: tere – A Faster Alternative to cd+ls by kybernetyk on Friday July 15, 2022 @09:17AM (#32107844)
Just wait till the deps go away or change in some significant way.
Re:Show HN: tere – A Faster Alternative to cd+ls by steveklabnik on Friday July 15, 2022 @12:18PM (#32109704)
They cannot be removed without good reason (like “here’s a letter from my lawyer” or “this code secretly exfiltrates credentials”), and a lock file means that even if they change, your usage of them won’t until you ask to upgrade versions.
Re:Show HN: tere – A Faster Alternative to cd+ls by sayanarijit on Friday July 15, 2022 @09:48AM (#32108160)
Not in rustland.