[-] BatmanAoD@programming.dev 20 points 1 week ago* (last edited 1 week ago)

[warning: "annoying Rust guy" comment incoming]

I don't think Rust is perfect, but arguably I do "idolize" it, because I genuinely think it's notably better both in design and in practice than every other language I've used. This includes:

  • C
  • C++
  • Java
  • C#
  • Kotlin
  • Scala
  • Python
  • Ruby
  • JavaScript (...I've barely used this, but I doubt my opinion would change on this one)
  • Perl
  • Go
  • Bash (...look, I've had to write actual nontrivial scripts with loops and functions, so yes, Bash is a real language; it just sucks)
  • Tcl/Tk (if you don't know, don't ask)
  • CommonLisp (...again, I've barely used this, and I wish I had more experience with this and other Lisps)

In a literal sense, I agree that all (practical) languages "are flawed." And there are things I appreciate about all of the above languages (...except Tcl/Tk), even if I don't "like" the language overall. But I sincerely believe that statements like "all languages are flawed" and "use the best tool for the job" tend to imply that all (modern, mainstream) languages are equally flawed, just in different ways, which is absolutely not true. And in particular, it used to be true that all languages made tradeoffs between a fairly static, global set of binary criteria:

  • safety/correctness versus "power" (i.e. low-level system control)
  • safety/correctness versus run-time efficiency (both parallelism and high single-thread performance)
  • ease-of-use/ease-of-learning versus "power" and runtime-efficiency
  • implementation simplicity versus feature-richness
  • build-time versus run-time efficiency
  • type-safety versus runtime flexibility

Looking at these, it's pretty easy to see where most of the languages in my list above fall on each side of each of these criteria. What's special about Rust is that the core language design prevents a relatively novel set of tradeoffs, allowing it to choose "both" for the first two criteria (though certainly not the latter three; the "ease-of-use" one is debatable) at the expense of higher implementation complexity and a steeper learning curve.

The great thing about this isn't that Rust has "solved" the problem of language tradeoffs. It's that Rust has broadened the space of available tradeoffs. The assumption that safety necessarily comes at a runtime cost was so pervasive prior to Rust that some engineers still believe it. But now, Rust has proven, empirically, that this is not the case! And so my ultimate hope for Rust isn't that it becomes ubiquitous; it's that it inspires even better languages, or at least, more languages that use concepts Rust has brought to the mainstream (such as sum-types) as a means to explore new design tradeoff spaces. (The standard example here is a language with a lightweight garbage-collecting runtime that also has traits, sum-types, and correct-by-default parallelism.)

There are other languages that, based on what I know about them, might inspire the same type of enthusiasm if I were to actually use them more:

  • Erlang
  • Gleam
  • OCaml
  • Swift

...but, with the exception of Swift, these are all effectively "niche" languages. One notable thing about Rust is that its adoption has actually been rather astounding, by systems language standards. (Note that D and Ada never even got close to Rust's popularity.)

[-] BatmanAoD@programming.dev 24 points 3 weeks ago

It would be a valid point if he weren't literally speaking over the people trying to tell him that they're not demanding he learn Rust: https://youtu.be/WiPp9YEBV0Q?si=b3OB4Y9LU-ffJA4c&t=1548

[-] BatmanAoD@programming.dev 25 points 3 weeks ago

Oh jeeze, you have no idea. You can watch it yourself: https://youtu.be/WiPp9YEBV0Q?si=b3OB4Y9LU-ffJA4c&t=1548

That timestamp is about where the audience member (a maintainer of ext4 and related utilities) starts speaking. The "here's the thing" quote is around 28:40.

[-] BatmanAoD@programming.dev 21 points 1 month ago

First and foremost _____ is a giant hack to mitigate legacy mistakes.

Wow, every article on web technology should start this way. And lots of non-web technologies, too.

[-] BatmanAoD@programming.dev 17 points 2 months ago

rm - rf is the only version that makes sense, since the only reason to delete and re-clone is to recover from an unexpected .git/ state, and git rm won't remove that.

[-] BatmanAoD@programming.dev 22 points 4 months ago

Rust is extremely geared toward maintainability at the cost of other values such as learnability and iteration speed. Whether it's successful is of course somewhat a matter of opinion (at least until we figure out how to do good quantitative studies on software maintainability), and it is of course possible to write brittle Rust code. But it does make a lot of common errors (including ones Go facilitates) hard or impossible to replicate.

It also strongly pushes toward specific types of abstractions and architectural decisions, which is pretty unique among mainstream languages, and is of course a large part of what critics dislike about it (since that's extremely limiting compared to the freedom most languages give you). But the ability for the compiler to influence the high-level design and code organization is a large part of what makes Rust uniquely maintainability-focused, at least in theory.

[-] BatmanAoD@programming.dev 15 points 5 months ago

Perl programs are, by definition, text. So "paint splatters are valid Perl" implies that there's a mapping from paint splatters to text.

Do you have a suggested mapping of paint splatters to text that would be more "accurate" than OCR? And do you really think it would result in fewer valid Perl programs?

[-] BatmanAoD@programming.dev 18 points 5 months ago

And in fact it's not specific to Rust, and Rust is the first language with a fix available. (Thanks to some other comments for pointing this out.) Java has apparently declared it "won't fix."

https://flatt.tech/research/posts/batbadbut-you-cant-securely-execute-commands-on-windows/#appendix-b-status-of-the-affected-programming-languages

[-] BatmanAoD@programming.dev 22 points 6 months ago

That's true in C as well, though. This is what people mean when they say things like "undefined behavior can result in time travel".

The difference is twofold:

  • Rust's rules for valid unsafe code are not completely formalized yet. This means that there are open questions about whether particularly complex patterns in unsafe code will be guaranteed by future versions of the compiler to be sound. Conversely, the C and C++ spec are generally sufficient to determine whether any particular piece of code has undefined behavior, even if actually analyzing it to find out is not possible automatically using existing static analysis tools.
  • Because safe Rust is so strict about what it permits, the compiler is able to make more aggressive optimizations; in theory, this could indeed cause undefined behavior to be "worse" at runtime than a comparable situation in a globally-unsafe language. I'm unaware of any actual examples of that phenomenon, though.
[-] BatmanAoD@programming.dev 26 points 7 months ago

To play devil's advocate, most systems programming can be done even with a garbage collector. Midori was a project to build an operating system on a variant of C#, and although the garbage collector did impose technical difficulties, it wasn't a dealbreaker. Go isn't usable everywhere Rust is, but it can in fact be used for many things that previously would have been considered "systems" niches (which is part of why there was a somewhat prevalent misconception in the early days of Rust that they were similar languages). Prominent D developers have defended D's garbage collector (even though it's technically optional). Bjarne Stroustrup, the creator of C++, used to express great confidence that C++ would one day have a garbage collector.

...but you're right, Rust and its rise in popularity (and, conversely, the C++ community's resistance to adopt anything with garbage collection) have definitely narrowed the common definition of "systems programming" to exclude anything with a "thick" runtime.

[-] BatmanAoD@programming.dev 16 points 8 months ago

Go if you want a real mental challenge

I don't mean to be rude, but I find this baffling; what do you mean by it? One of the primary design goals of Go is to be simple to learn (this is fairly well documented), and it's one of the few things I really have to give the language credit for. Rob Pike has specifically discussed wanting it to be accessible to recent CS graduates who have mostly used Java. I have never heard anyone before describe learning Go as a "challenge."

[-] BatmanAoD@programming.dev 17 points 9 months ago

Neovim is a fork; it's compatible with those.

view more: ‹ prev next ›

BatmanAoD

joined 1 year ago