Most coveted Rust features


#1

I’m wondering what are the most coveted Rust features, that aren’t currently in Rust?

Things like Higher Kinded Types, default parameters, etc. You can use the hear near post to give your +1 to an idea.


#2

From the top of my head (my wishlist):

  • HKT: no RFC
  • Default type params: RFC accepted, AFAIK need someone to implement it
  • Implied bounds: Planned, I think Niko is working on it
  • Negative bounds: RFC in discussion
  • Send doesn’t need 'static: RFC accepted, already being worked on
  • Nonzeroing dynamic drop: RFC accepted, being worked on
  • Abstract return types: RFC closed for further revision
  • Abstract associated types: no RFC, same idea as abstract return types though

#3

I kinda wanted one wish per post :stuck_out_tongue: so it’s easier to see which is most
coveted.

I’m gonna go with Higher Kinded Types (HKT). The list of problems they
solve is staggering, but as I understand they are too complex and they
interact badly with inheritance. It’s possible I’m wrong on this account.


#4

Inheritance/code reuse.


#5

My most coveted Rust feature is having the most comprehensive cross-compilation story in the world.

Other than that I want Rust to slow down and bake the features it already has.


#7
  • non-lexical borrows (SEME regions)
  • type constructors (HKT)
  • trusted iterator lengths
  • generics over integers
  • allocator API
  • inherent trait impls
  • ways to disable unwinding at a scope or application level
  • unsafe operators?

#8

I’m not sure what is missing here. We have trait inheritance, I don’t see struct inheritance as interesting.

What kinds of code reuse are missing?


Usecases for inheritance
#9

Lazy evaluation/assignment (like in Haskell).


#10

I want to look at an assert!(n < 0) and not read it as assert(!n < 0) or assert(!(n < 0)). Friggin annoying.


#11

Highlighting helps a lot here.

In my editor the assert! is highlighted in red, so there’s no question as to what the ! part belongs to.


#12

I don’t see how that fits into the predictability of Rust code.


#13

I think that he would like one of the following “efficient inheritance RFCs” to be accepted :


#14

Further improvements to rustfmt and rustfix.


#15

Keyword arguments and default argument values.


#16

I think anything that has more types able to implement PartialEq and Debug either automatically or at all would be great. I think there is an RFC for auto derivation so that is a start. I use these traits for testing and its annoying when I randomly end up with something that can’t be compared or output by assert_eq.

That and fixing some of the ICEs around compiler weirdnesses around traits would be great :smile:


#17

Mine (vim) does that too, but 16 years or so of being trained that ‘!’ is very, very special can’t be changed by some color. I think @assert(), $assert(), or macro.assert() would be less frustrating. When asserts trip, the ‘impossible’ has happened so you don’t need any extra cognitive load when chasing them down. Also in python2 assert is a keyword so assert!(x) means something very, very different.


#18

Parameterized modules a’la OCaml’s.


#19

Could you elaborate what are parameterized modules? Are they related to HKT?


#20

I think he means:

mod something<T> {
  fn do_something(value: T) { /* ... */ }
}

Although I don’t see why it’s really that useful…


#21

For me, it would probably be integer-based generics. This would fix various annoyances, such as the arbitrary limits on the length of arrays for which standard traits are implemented.