Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

671–680 of 736 posts

Re: Was Rust Worth It?

#671
post #642

Earlier quoted context omitted.

> compiled managed languages like [...] C# I've been out of the windows development game for a long time, so I haven't used C# since it strictly required a VM... what's pre-compiled C# development like nowadays? Are there major caveats? If you can emit plain old binaries in C# with no runtime dependencies, that would make it a truly compelling language IMO. And as another question, what's the cross-platform (mainly L…

C# supports AOT since forever, NGEN was present in .NET 1.0. Not many people used it, because it requires signing binaries and only supports dynamic linking, with a performance profile towards fast startup. On Microsoft side the Singularity and Midori experiments used AOT. They influenced the AOT toolchains for Windows 8 store apps with MDIL (Singularity/Bartok), and Windows 10 store apps with .NET Native (Midori/Pro…

In 8, NativeAOT also supports iOS (and even Android reportedly?) for, I assume, MAUI target to do away with Mono. Documentation on this definitely needs work, and there are projects that made it working with WPF, Windows Forms and Avalonia back in .NET 7. Arguably, none of those were particularly user-friendly but generated COM interop project for 8 was done specifically to improve this on Windows as well.

Re: Was Rust Worth It?

#672
post #663

Earlier quoted context omitted.

I want to understand what you just said, but I fear watering your language down a bit might be a tall ask with some people. Would you be willing to eli5 what you believe Go did that was a horrible decision with regards to module/package namespacing?

I think what they mean is: if you see a line like `import git.example.com/foo/bar/baz`, that could be package `baz` inside module `git.example.com/foo/bar`, or it could be package `bar/baz` inside module `git.example.com/foo`. Also, even if you know it's the latter, package namespacing isn't strictly related to directory structure, so `bar/baz` has no specific meaning outside of the context of a go import. They could…

Ah that makes sense. I think Go did somewhat stumble a bit in the early days due to this, especially with repositories in GitLab, where GitLab allows essentially a directory tree where your repository can be nested indefinitely in directories like `https://gitlab.com/mygroup/subgroup1/subgroup2/repository`.

I still don't think this is a huge issue, to be honest. Not one big enough for me to complain about, for sure. But it's definitely not ideal.

Re: Was Rust Worth It?

#673

Earlier quoted context omitted.

I used to be .NET dev and don't agree. Couple of reaons: 1) Modern Java is almost as good as C# with some things I can't give up in Java (static imports => succint code, Groovy Spock => succint tests) 2) Kotlin is better than C# 3) JVM has much much bigger ecosystem (almost all the apache projects are JVM oriented) and default web framework is much less code to type (SpringBoot) is much more productiv 4) JVM has wide…

Also with JDK 21 - you can use virtual threads. No need for async/await which IMHO is a design mistake. Java copied Go here instead of C#.

Which makes C interop worse, just like Go

Re: Was Rust Worth It?

#674

Earlier quoted context omitted.

C# is underrated by the HN crowd, I find. I quite like how mid sized firms (100-1000 employees) use it.

C# is a lovely language to work with. The only issue I have is with the .NET ... that is, building self-contained binaries to distribute. For comparison: * Hello World win-x64 binary self-contained in .NET 7 is around 70 MB * The same for Go results in 1.2 MB Edit: Missed 'trimming' in .NET, which would result in a binary of size around 11 MB in win-x64

Idk the last time you tried but a hello world in C# using .Net 8 is smaller than a Go hello world, for what it’s worth.

Re: Was Rust Worth It?

#675
post #548
post #442

Earlier quoted context omitted.

> This is factually impossible. How do you outright deny something as subjective as my personal experience? Besides, I'm not the only one in this discussion that made the same opinion. > For anything larger than (very) small programs, Rust requires an upfront design stage, due to ownership, that it's not required when developing in GC'ed languages. While GC'ed languages allow you to skip a proper initial design stage…

This is possible if you are really slow in python

Or maybe they mean "fast to 1.0" rather than "fast to 0.1"?

They didn't specify.

Re: Was Rust Worth It?

#676
post #513

Earlier quoted context omitted.

It is, however those same companies aren't dialing full safe ahead knob either, hence why Microsoft just recently published a set of secure coding guidelines for C and C++. https://devblogs.microsoft.com/cppblog/build-reliable-and-se...

Quite annoying to read in my native language, German. Do they use automatic translations? It's full of grammar errors and mistranslations.

[deleted]

Re: Was Rust Worth It?

#677
post #650

Earlier quoted context omitted.

Consider: #define _FOO int main() {} Per the C++ standard ([lex.name]/3), this program is ill-formed: > In addition, some identifiers appearing as a token or preprocessing-token are reserved for use by C++ implementations and shall not be used otherwise; no diagnostic is required. [...] Each identifier that contains a double underscore __ or begins with an underscore followed by an uppercase letter is reserved to the…

> Thus, the compiler theoretically has the liberty to emit whatever it wants for this program. In theory, sure. In practice, what does it do? We can look and see.[0][1][2] (I don't know of any compiler that emits garbage in the example you listed). For some reason, there's this sentiment that's arisen that treats undefined behavior as some sort of bugaboo that's capable of anything and everything (including summoning…

First of all, and most importantly, we're not talking about Undefined Behaviour, which happens at runtime, but about IFNDR (Ill-formed, No diagnostic required), which means at compile time your program has no meaning whatsoever because it's not a well-formed C++ program after all but your compiler doesn't tell you (and because of Rice's Theorem in many cases cannot possibly do so as it can't determine for sure itself)

This is a conscious choice that C++ made, and my belief is that once you make this choice you have an incentive to make it much worse over time e.g. in C++ 11, C++ 14, C++ 17, C++ 20, and now C++ 23. Specifically, you have an incentive to allow more and more dubious code under the same rule, since best case it works and worst case it's not your fault because if it doesn't work it was never actually a C++ program anyway...

Still, since you decided to talk about Undefined Behaviour, which is merely unconstrained misbehaviour at runtime, let's address that too.

For the concurrency case no, humans can't usefully reason about the behaviour of non-trivial programs which lack Sequential Consistency - which is extremely likely under Undefined Behaviour. It hurts your head to even think about it. Imagine watching an avant garde time travel movie, in which a dozen characters are portrayed by the same actor, the scenes aren't shown in any particular order and it's suggested that some of them might be dreams, or implanted memories. What actually happened? To who? And why? Maybe the screenwriters knew but you've no idea after watching their movie.

Today a huge proportion of software is processing arbitrary outside data, often as a service directly connected to the Internet. As a result, under Undefined Behaviour the unconstrained consequences may be dictated by hostile third parties. UB results in things like Remote Code Execution, and so yes, if they wanted to the people attacking your system certainly could turn it into a Pac man game.

We should strive to engineer correct software. That we're still here in 2023 with people arguing that it's basically fine if their software is not only incorrect, but their tools deliberately can't tell because that was easier is lunacy.

Re: Was Rust Worth It?

#678

Earlier quoted context omitted.

I'm sorry you're having a bad experience. I've found changing a couple habits developed in other languages helped me to have a good experience with Rust's diagnostics. 1. Reading the error messages. I was used to error messages verbosely printing a lot of details which were mostly irrelevant and letting the programmer sort it out, and I developed a habit of skimming them. I had a better time with Rust when I realized…

No thanks, that seems a long winded way of saying you're not welcome here unless you think exactly like me.

Wasn't my intention. I'm sorry if I came off that way, I can see how my comment might be presumptive or pretentious. My bad. You don't have to do any of that. You don't even need to write Rust in my book, it's not the one true language or anything. That's just what's working for me personally.

My first six months with Rust were very painful and I struggled to write the simplest programs. (This was in fact, the first six months of my second attempt - the first time I tried to learn it, I gave up.) Eventually I learned how to work with it, and since then, it's my absolute favorite language to work in (though presently I mostly write Typescript and SQL, because I'm writing webapps). I tried to summarize what happened along the way and what changed.

Re: Was Rust Worth It?

#679

Earlier quoted context omitted.

> At this point, I'm about as fast in Rust as I am in Python. This is factually impossible. For anything larger than (very) small programs, Rust requires an upfront design stage, due to ownership, that it's not required when developing in GC'ed languages. This is not even considering more local complexities, like data structures with cyclical references.

Couldn't one use Arc and similar boxed types to avoid thinking about memory until later?

Why not just something like nim and that point, and straight up ditch 90% of the complexity?

Re: Was Rust Worth It?

#680
post #632

Earlier quoted context omitted.

I am referring to userspace / userland drivers. https://www.kernel.org/doc/html/v4.18/driver-api/uio-howto.h...

But you can write userspace drivers in any language, as long as that language has basic file I/O and mmap() support. There's nothing special about using Rust for userspace drivers.

Isn't this false? Don't certain languages basically need, say, a libc that isn't nessesarily available in kernel space?
Post reply on HN