@ekuber@hachyderm.io
@ekuber@hachyderm.io avatar

ekuber

@ekuber@hachyderm.io

"We spent decades trying to invent a sufficiently smart compiler when we should have been inventing a sufficiently empathetic one."

Rust Compiler team member. If you have to search for answers when the compiler is talking to you, that's a bug.

There are no bad programmers, only insufficiently advanced compilers.

Cache-locality awareness evangelist.

๐Ÿ’ผ@aws, opinions my own

he/him

Trans rights are human rights

This profile is from a federated server and may be incomplete. Browse more on the original instance.

faassen, to rust
@faassen@fosstodon.org avatar

I wonder how to best describe how influences design, for better or worse. Here is some rambling...

It makes you avoid cyclical data structures, and you are far more aware of ownership. This makes surprising action at a distance harder. It also makes it more difficult to misuse globals or struct fields as globals just to pass data along to where it is needed no matter how.

Enums turn out to replace dynamic dispatch very often. Inheritance is just gone.

1/n

ekuber,
@ekuber@hachyderm.io avatar

@faassen One thing about traits is that it makes thinking about Rust code closer to how I think about relational databases.

I am reminded of

"Show me your flowchart and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won't usually need your flowchart; it'll be obvious." -- Fred Brooks, The Mythical Man Month (1975)

which significantly shaped how I think about problems. Traits + ADTs put you in the same frame of mind.

heaths, to rust
@heaths@fosstodon.org avatar

โ€œDev by a thousand cutsโ€

Thatโ€™s often what feels like. I started learning C in the late 80s and BASIC before that. Since then Iโ€™ve become an expert in several languages and proficient in several others. Iโ€™m an experienced and though the rust compiler is by far the most helpful - and pushing other compilers to improve - thereโ€™s a lot of sharp edges in the grammar itself. Some other polyglots Iโ€™m getting into the language agree.

ekuber,
@ekuber@hachyderm.io avatar

@heaths could you elaborate on the sharp edges you're encountering? We are aware of many, but it's good to double check in case there are any we don't know about yet.

ekuber,
@ekuber@hachyderm.io avatar

@heaths my general advice is "keep calm and call clone". You can get people used to the rest of the language before getting too bogged down with lifetimes. The biggest source of pain is structs and enums with lifetimes, so I would avoid storing references in fields except in the simplest of cases at first.

ekuber,
@ekuber@hachyderm.io avatar

@heaths I'm working on a linter that amongst other things can detect when a given function can allocate. Having said that, ensuring that no allocations happen is something that only languages like Zig that require passing the allocator instance (by convention, IIUC) have.

ekuber,
@ekuber@hachyderm.io avatar

@heaths if anyone is making other people feel foolish, they should be receiving strong push back from other people in the community, otherwise we've failed.

Have you seen rustlings, the rust cookbook and the rust for rustaceans book?

ekuber,
@ekuber@hachyderm.io avatar

@heaths I'm apprehensive about pushing people just learning the language towards the most performant approaches early on, because thats how you end in the pit of "I don't know if I need a magic incantation or the language just won't accept it at all". I prefer getting people to working prototype first, and then measure performance. Armed with a flame graph you might get rid of a bunch of unnecessary allocations, but many would remain because they are not in the critical path.

ekuber,
@ekuber@hachyderm.io avatar

@heaths same with people avoiding Box<dyn Trait> because of the v-table jump: almost every time ive heard that as the justification, after measuring there was no real difference in production workloads.

ekuber,
@ekuber@hachyderm.io avatar

@heaths I'm convinced that the problem is that inefficient code in Rust is generally visible, so people try to optimize, and then they get stuck in a place where they need to understand what where for<'a> T: &'a K means, which you should very rarely need.

ekuber,
@ekuber@hachyderm.io avatar
ekuber,
@ekuber@hachyderm.io avatar

@heaths Nick is part of the project. Of course there's no need not to need to know that. The project takes a stance of allowing the community to take over as much as possible and rely on "social proof" for what the best resource is. This hurts discoverability, but allows for faster iteration on the resources. If Rust was a product from a company, that perf book would definitely be part of the standard site.

https://nnethercote.github.io/2024/03/06/how-to-speed-up-the-rust-compiler-in-march-2024.html
https://github.com/nnethercote

soller, to random
@soller@fosstodon.org avatar

I wrote a PDF reader with libcosmic yesterday. While it is very basic and not likely to be ready for the first COSMIC release, it is pure rust, lightweight, GPU accelerated, and highly portable.

ekuber,
@ekuber@hachyderm.io avatar

@lw64 @soller I believe that the implication when that phrase is used is that cargo run and cargo install --path . will work without additional environment set-up. And that if you're a Rust developer there's no part of the application that you can't modify yourself, of course.

ekuber,
@ekuber@hachyderm.io avatar

@lw64 @soller parsing is precisely one of those libraries that I appreciate being done in Rust. It's its raison d'รชtre. Parsing untrusted input in a language that can easily turn malformed input into runnable code has historically being an endless source of security issues.

mcc, to random
@mcc@mastodon.social avatar

There's this thing in Rust where there is an ideology that features are additive, and therefore there is no need to have the ability for Cargo to create a dependency which is conditional on a negation. And then when you encounter a situation where you need Cargo to create a dependency which is conditional on a negation, you can't, and if you ask why not the answer will be because features are additive and therefore there is no need for such an ability

ekuber,
@ekuber@hachyderm.io avatar

@mcc the reason features are additive is because cargo evaluates the whole dependency graph at once. If there are two edges to the same dependency, they are considered the same dependency. If through one path you set one feature, and through the other path you set the other, cargo has to assume that both have to be turned on. The alternatives would be explosion of unnecessarily duplicated dependencies, or more painful dependency management.

ekuber,
@ekuber@hachyderm.io avatar

@mcc the original comment made it seem that the reason for them being additive was arbitrary and circular. It sucks we don't have a better solution for your problem.

wezm, to programming
@wezm@mastodon.decentralised.social avatar
ekuber,
@ekuber@hachyderm.io avatar

@wezm want

ekuber, to rust
@ekuber@hachyderm.io avatar

Sometimes I wish that rustc had a database of small breaking changes that affect only a handful of crates, so that we could on the fly patch them going forward. Things like "we now correctly check for lifetimes in assoc types" can technically be a breaking change that affects a handful of crates, but I want to ensure that building a project from today in 15 years doesn't require a compiler tool chain from today.

I guess this is the windows backwards compatibility approach.
#rust #rustlang

ekuber,
@ekuber@hachyderm.io avatar

@matthiaskrgr we could be able to. We could downgrade the error to a warning then ๐Ÿค”

ekuber,
@ekuber@hachyderm.io avatar

@chrisg we already do for a handful of things. Macro handling comes to mind. The principled answer is "editions", of course.

ekuber,
@ekuber@hachyderm.io avatar

@chrisg I guess so. The problem is the maintenance burden of alternative behavior for fundamental checks, but that's kind of what we signed up for with editions.

ekuber,
@ekuber@hachyderm.io avatar

@kornel you would want to make patch releases for pretty much every affected dot release, but that would likely be the best option.

ekuber, to rust
@ekuber@hachyderm.io avatar

" development is going too fast (because they are stabilizing features I don't care about) and going too slow (because they are not stabilizing features I care about!"

There are only so many contributors, hours in a day, days in a year to get to everything now, and some features are reliant on other, less flashy work that needs to happen before they can be even attempted.

But people are putting in a lot of work, the codebase changes so quickly that it is hard to keep up.

ekuber,
@ekuber@hachyderm.io avatar

@manpacket has there been any feedback on the fcp yet? Wrangling checkbox ticking can be difficult (particularly from users with lots of notifications). Do not forget that the backcompat requirements of the project are so high that it's hard to gain confidence or agreement on any user visible change. It's not ideal.

ekuber,
@ekuber@hachyderm.io avatar

@manpacket by the way, thank you for rolling up your sleeves and working on it.

My rant was directed at people who don't, yet volley critiques that are not borne from reality. Your concerns are very real.

ekuber,
@ekuber@hachyderm.io avatar

@manpacket yes.

Feel free to send me the link to the RFC and I'll take a look at it.

jhpratt, to rust
@jhpratt@mastodon.social avatar

Hit an edge case in the #Rust compiler that appears to be quadratic at best and potentially exponential. Trivial to make happen with real-world code. Investigating...

#RustLang #programming

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt @predrag replacing bodies with loop {} is the first step I do, I'm guessing this is on some where bound or impl Trait return?

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt @predrag I'm sure @errs will be looking forward to the report ๐Ÿ˜€

hds, to random
@hds@hachyderm.io avatar

@ekuber I just missed the fn keyword and found that the error message in that case wasn't so helpful.

error: expected one of ! or ::, found (

I couldn't find a issue for this, but I thought I'd check with you before creating one.

ekuber,
@ekuber@hachyderm.io avatar

@hds thank you!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • โ€ข
  • megavids
  • kavyap
  • DreamBathrooms
  • InstantRegret
  • magazineikmin
  • osvaldo12
  • everett
  • Youngstown
  • khanakhh
  • slotface
  • rosin
  • thenastyranch
  • ngwrru68w68
  • Durango
  • JUstTest
  • normalnudes
  • ethstaker
  • GTA5RPClips
  • modclub
  • cisconetworking
  • mdbf
  • tacticalgear
  • cubers
  • provamag3
  • tester
  • anitta
  • Leos
  • lostlight
  • All magazines