|
|
@pcwalton | |||||
|
Easy to say "monomorphization is awful and Rust should never have done it", harder to say "I want all generic functions to be compiled to bytecode and to embed a Rust interpreter in every binary".
|
||||||
|
||||||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
I'm increasingly convinced that the interpreter solution is the only reasonable alternative for Rust.
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
*I'm* actually OK with this as an opt-in compilation mode, at least for cold functions. But are the people complaining about compilation time OK with it?
|
||
|
|
||
|
Tony “Abolish ICE” Arcieri 🦀
@bascule
|
30. sij |
|
I just want the flag to say "I'll write all my code the monomorphizable way but I'll take smaller code at the cost of worse performance so please treat all my generics and impl Traits like they're dyn".
...because @rustembedded
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
30. sij |
|
You can’t just treat generics and impl Traits as dyn. That leads to intensional type analysis which is just not worth it.
|
||
|
|
||
|
Tim Sweeney
@TimSweeneyEpic
|
31. sij |
|
I don’t think you’d need a full bytecode interpreter to support runtime polymorphism, but just a bunch of RTTI mojo for boxing and unboxing values, and looking up traits by type via dictionary. Haskell type classes are implemented this way.
|
||
|
|
||
|
|
Patrick Walton
@pcwalton
|
31. sij |
|
Haskell has a uniform type representation. If you go down that road with a language like Rust you end up with Swift-like intensional type analysis, which gets hairy really fast.
|
||
|
|
||
|
Joe Groff
@jckarter
|
30. sij |
|
turning a big dial taht says "bytecode" and "monomorphization" and constantly looking back at the audience for approval like a contestant on the price is right
|
||
|
|
||
|
Slava Pestov
@slava_pestov
|
31. sij |
|
Maybe the real problem is that generics are actually bad
|
||
|
|
||
|
Carl DB
@carllerche
|
30. sij |
|
I dunno, "monomorphization" is pretty hard to say. While "I want all generic functions to be compiled to bytecode and to embed a Rust interpreter in every binary" is longer, I found it easier to say.
|
||
|
|
||
|
electronic liza
@mycoliza
|
30. sij |
|
wait, do people say this? monomorphization is absolutely one of my top 10 favorite things about Rust
|
||
|
|
||