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

ekuber, to rust
@ekuber@hachyderm.io avatar

Out of curiosity, I did a quick check to see how many impl Trait return types are object safe in the rustc codebase, meaning they could always be turned into a type-erased Box<dyn Trait>, and the ratio of object-safe/not object-safe is ~10:1.
I don't know what that tells us, but found it interesting.
I wonder what the performance impact in compile times and the produced binaries of turning these into trait objects automatically and transparently.

#RustLang #rust

ekuber,
@ekuber@hachyderm.io avatar

This seems to be in the same "neighborhood" as "polymorphization" (turning functions with type parameters into functions that take trait objects without developer action when it would not affect runtime performance, improving compile times by avoiding monomorphization and reducing generated code).

ekuber,
@ekuber@hachyderm.io avatar

@SeanOMik impl Trait is a "materialized" type, it's an alias for "some type that implements Trait", which means that all of the monomorphization logic has to be applied to it. Box<dyn Trait> is a "type erased trait object", meaning that at runtime all its methods go through a "V-Table", which means during compilation you no longer need to care about what the actual type is for type checking.

ekuber,
@ekuber@hachyderm.io avatar

@SeanOMik All of this is relevant when you have method call chains or recursive method calls where you return "something that implements Trait". Like for Iterator. Each call to .map() on an iterator will create a new type Map<T> where T is all of the previous types. if .map() returned a trait object, evaluation of the type would be done in one go, instead of having to evaluate the heavily nested type.

ekuber, to random
@ekuber@hachyderm.io avatar

"I will not engage in the Discourse. Discourse is the little-death that brings total obliteration. I will read the Discourse. I will permit it to pass over me and through me. And when it has gone past I will turn the inner eye to see its path. Where the Discourse has gone there will be nothing. Only I will remain."

ekuber, to rust
@ekuber@hachyderm.io avatar

Rust's unexpected super-power is just how flexible it is. It allows you to write very high level looking code on a low level language. That caused people to use it beyond its intended niche. But it is fundamentally a low level programming language. It will continue becoming easier to use (that's my personal goal!) but there are "obvious" changes that would make things easier at the cost of speed or correctness that cannot take.

ekuber,
@ekuber@hachyderm.io avatar

I think there is a Rust-like language that accepts inference at the cost of perf and speed, that has less stringent backwards compatibility assurances, that interacts with Rust natively. But that can't be "Rust".

ekuber,
@ekuber@hachyderm.io avatar

I personally want that "Rust#" to exist if nothing else to use it as a test bed for Rust features with real world usage. I think there are tons of small things we can do that will make Rust easier to use, but some of the issues with "spaghetti of global state" designs will never be not painful in the language. Some of them can be mitigated with better libraries (allowing granular Singleton field access without keeping locks on the global object), but likely not all of them will.

ekuber,
@ekuber@hachyderm.io avatar

An example I can give: Rust doesn't support return type inference. You can use impl Trait for that. You can also write -&gt; _ and the compiler will tell you what type it would have inferred for you to write down there. Global return type inference won't ever be allowed in Rust. But maybe we could allow it inside of a single module? A single crate? I would expect the DX to be crap, but we could technically do it without losing too much on correctness.

ekuber, to rust
@ekuber@hachyderm.io avatar
skinnylatte, to random
@skinnylatte@hachyderm.io avatar

Starting a thread about my life with Cookie, while she’s in intensive care right now in San Francisco. She’s still conscious, but it’s not looking great. Even if she gets to come home I think it’s time to prepare to say goodbye to her.

  1. This was the very first time I saw her.

I was 24 years old. I’d just moved to Petaling Jaya, Malaysia. With the first serious girlfriend I had. We thought it’d be a great idea to get a dog.

I took a pic of the moment I saw Cookie in Damansara Uptown

ekuber,
@ekuber@hachyderm.io avatar

@skinnylatte it's clear cookie is loved and she knows it

ekuber, to rust
@ekuber@hachyderm.io avatar

Somewhat cursed idea: "attributes at a distance"

#![attr(target = crate::foo::Bar)]

mod foo {  
 struct Bar;  
}  

What would you use this for?

ekuber,
@ekuber@hachyderm.io avatar

The idea came in the context of lints, after looking at how C# deals with them, the following is expressible there:

#![allow("unused", target = crate::foo::Bar)]

mod foo {  
 struct Bar;  
}  
ekuber,
@ekuber@hachyderm.io avatar

@muvlon I have been accused of being incoherent in the past 😋

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt you're thinking an "allow in this project the use of this explicit deprecated item"? That seems like a good argument for lint arguments.

ekuber,
@ekuber@hachyderm.io avatar

@mo8it be aware that with proc-macros and build files you can commit multiple non-locality crimes today 😬

ekuber,
@ekuber@hachyderm.io avatar

@jhpratt 😄
None of the reasons that come to mind are non-horrifying

dx, to random
@dx@mastodon.social avatar

"here's a sound i don't know how to explain because i have no idea how it works"

80s guitar guy making 80s guitar guy sounds

ekuber,
@ekuber@hachyderm.io avatar

@dx Tech in a nutshell

secana, to rust
@secana@mastodon.social avatar

If there is one thing I would like to change in it's the compile time. Stuck in a docker build loop, where I have to build from scratch anytime needs foreeeeever. 🦀

ekuber,
@ekuber@hachyderm.io avatar

@Toasterson @secana This. I haven't used docker in years, but back when I did IO throttling was a huge problem for me with both rustc and databases.

ekuber, to random
@ekuber@hachyderm.io avatar

Every time there's a CVE affecting some fundamental part of modern computing that Rust provides a dot-release for, it seems multiple publications find out first from the Rust blog and publish titles implying that Rust is the only affected thing. It's not only mildly annoying hearing the echos of "har, har, I thought it was 'safe'", it does a complete disservice to anyone that doesn't use Rust because they won't find out they have to update or mitigate the issue too!

ekuber,
@ekuber@hachyderm.io avatar

@soller what if we used an LLM? I'm currently raising my Series A funding round for it.

ekuber,
@ekuber@hachyderm.io avatar

As an example, the highlighted area is the first time this article mentions that every language is affected by the windows command escaping issue. This is actively harmful, not to Rust reputation, but to the users of other languages!

ekuber,
@ekuber@hachyderm.io avatar

@supernov no one should do that alone nor for a long time. But it is a good muscle to exercise. Otherwise it's hard to improve.

ekuber,
@ekuber@hachyderm.io avatar

@djc in hindsight, I think the blog should have linked to the BatBadBut post

ekuber,
@ekuber@hachyderm.io avatar

@mgattozzi fair point, I indeed missed it

Elucidating, to random
@Elucidating@mastodon.social avatar

The American tech scene would explode in a second Renaissance if the US got basic universal health care as a public right.

ekuber,
@ekuber@hachyderm.io avatar

@Elucidating @khionu retiring to a farm isn't the goal, the goal is to have an escapist fantasy to get through the day.

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