Live data from Hacker News

Was Rust Worth It?

jsoverson.medium.com

521–530 of 736 posts

Re: Was Rust Worth It?

#521

Earlier quoted context omitted.

I am curious what kind of code you are writing? Is it very low level or very high? >I know rust gives memory safety and how important that is, but the ergonomic is really bad. Every time I write some rust I feel limited. I always have to search libraries and how to do things. I cannot just "type the code". You don't have to search libraries and figure out how to do things in Zig?

It's hard to describe, but in some languages, you spend a lot less time looking at reference docs and more time just naturally writing the solution. Lisp is a great example of that, if you get through the learning curve.

I suspect Zig libraries feel easier because they're doing easier things. I bet if you try to draw a triangle with the Vulkan API in Zig, you'll find yourself looking at the reference docs a lot.

Re: Was Rust Worth It?

#522
post #286

Earlier quoted context omitted.

> but the ergonomic is really bad. Every time I write some rust I feel limited. > But I do not think it is a good general purpose language. Remember that this is not a sentiment that's shared by everyone. I use Rust for tasks that need anything more complicated than a shell script. Even my window manager is controlled from a Rust program. I say this as someone who has been programming in Python for nearly two decades…

What window manager is that, may I ask out of curiousity?

Sway. And river, sooner or later. A single Rust program is used for setting up services (using s6-rc on Gentoo), shutdown, reboot, idle inhibit, etc.

Re: Was Rust Worth It?

#523

Earlier quoted context omitted.

URLs are well structured and unique, with a sensible default - sourcing the file from the internet - and ubiquitous processes for easily mapping the URL to an alternative location. I.e., when you're going to run the production build, the URLs are mapped to fetch from the vetted cache and not the internet. I don't see any downsides to allowing them as a source, or making them the default approach

> and ubiquitous processes for easily mapping the URL to an alternative location. This seems strange to me because the whole point of a Uniform Resource Locator is to specify where a resource can be located. It's a bit like saying "My project depends on the binder on shelf 7 in Room 42, sixth binder from the left. Except when I go into production, then use...." Don't tell me what binder it's in, tell me what it is. I…

Fully qualified domain names (java/maven) aren't URIs. The latter are far more transient. Maybe a form of permalink could work, but that likely places too great a burden on package maintainers. I don't see that working out honestly.

Re: Was Rust Worth It?

#524
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...

Does it have tooling to enforce those guidelines? If not, how is it better than someone saying "write correct code" and calling it a guideline?

Partially, in Visual Studio and GitHub.

Re: Was Rust Worth It?

#525

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.

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…

I think Java is only good for long-running servers.

Java doesn’t support C interop. For many desktop and embedded projects this is a showstopper, here’s an example https://github.com/Const-me/Vrmac/tree/master/VrmacVideo That C# code directly consumes V4L2 and ASIO Linux kernel APIs, and calls unmanaged user-mode DLLs like libfdk-aac.so and liba52-0.7.4.so.

Native stack and value types in C# reduce load on GC, and the number of complicated tricks required from JIT compiler. This in turn helps with startup performance. This is critical for command-line apps, and very desirable for desktop apps.

Another thing missing in Java is intrinsics support, both scalar like popcnt, bitscan, BMI, etc., and SIMD like SSE and AVX.

Re: Was Rust Worth It?

#526
post #433

Earlier quoted context omitted.

Except in those other languages the compiler types .clone() for me.

Sometimes the compiler types clone for you even you don’t actually want it to.

It is easier to tell it, "don't do it this time" than all the time.

It is no accident that while Val/Hylo, Chapel and Swift have taken inspiration from Rust, they have decided to not inflict the affine types directly into the language users, rather let the compiler do part of the work itself.

Re: Was Rust Worth It?

#527
post #3
post #2

Perhaps my biggest critique is that crates.io has no namespacing. Anyone can just claim a global and generic package name and we mostly have to deal with it (unless you avoid using the crates.io repository, but then you'll probably have more problems...). Some of these globally-claimed generic packages are not really the best package to use. Maybe it was a reaction against the Java-style reverse DNS notation, which i…

Go made a great decision to namespace packages via this Github style.

Go packages is yet another design item that I dislike on the language, exposing SCM URLs directly on the source code, and no story for binary caching.

Re: Was Rust Worth It?

#528
post #286

Earlier quoted context omitted.

> but the ergonomic is really bad. Every time I write some rust I feel limited. > But I do not think it is a good general purpose language. Remember that this is not a sentiment that's shared by everyone. I use Rust for tasks that need anything more complicated than a shell script. Even my window manager is controlled from a Rust program. I say this as someone who has been programming in Python for nearly two decades…

> 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.

> 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.

It's nearly the opposite. For larger programs in Python, you need an upfront design stage because the lack of static typing will allow you to organically accrete classes whose job overlap but interfaces differ.

Meanwhile, Rust will smack you over the head until your interfaces (traits) are well-organized, before the program grows enough for this to become a problem (or until you give up and start over).

How do I know? I'm stuck with some larger Python programs that became a mess of similar-but-not-interchangeable classes. RiiR, if I ever have the time.

Re: Was Rust Worth It?

#529
post #176
post #142

Earlier quoted context omitted.

The answer here is almost certainly one of these: 1. Fix rhai::Engine so it is Send (if !Send is unintentional) 2. Use tokio::spawn_blocking or normal threads to run the rhai::Engine bits 3. Don't hold the rhai::Engine across an await point. Which one depends on rhai Engine details and what you want to accomplish. Doing a block on inside a new thread seems unlikely to do anything useful (unless there's some undisclos…

1. Not applicable unless it is absolutely required, and not something I will consider until I have exhausted other options, since there is a reason they have not made it Send already. It will likely be quite complex and enlarge the scope. 2. I am using a normal thread but when I make it async the compiler wants Send. 3. The await point is in code that uses the engine. I am not sure there is another good option, since…

> 2. I am using a normal thread but when I make it async the compiler wants Send.

This is likely because you are using the multi-threaded scheduler, which requires futures to be Send, even if you’re running only a single thread. This is because Tokio is based on a “work stealing” runtime, so in “normal” operations, expects the futures themselves to be able to be shuffled around threads where necessary.

For you use case, try running the single threaded executor, additionally try the “local set” executors. These do not require Send as they are statically guaranteed to be confined to the thread they are spawned on. Block on will also work.

Out of curiosity though, how is the interaction with Rhai performed, are you passing around the engine, and executing the code at certain points where applicable? Do you just need certain results from it sometimes? Etc?

Re: Was Rust Worth It?

#530

Earlier quoted context omitted.

I'm not trying to shame you, but how long have you been coding? I've not yet had the urge to ask an AI for coding help, ever. The questions that are decoupled enough from a field/project that it might be able to answer seem trivial and easy just to search on. Plus, I'm way more trusting of a Stack Overflow post or even a blog post than what AI generates. I mean, AI hallucinates all the time or generates things that a…

I'm pretty shocked by the grandparent, but on reflection, I think this is the future. In The Grapes of Wrath , Steinbeck writes about the travails of a family's trip to California in search of work during the Great Depression in the 1930s. Tom Joad, the father, fixes the compression in his blown engine by wrapping a copper wire around the cylinder, then running the motor until it melts and recreates the seal. It's su…

While it's a nice story, unfortunately it would appear as though Steinbeck didn't do enough research and thought the 1925 Dodge was built much like a Model T: https://forums.aaca.org/topic/134313-the-grapes-of-wrath/>
Post reply on HN