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".
-
Show this thread
-
Replying to @pcwalton
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
@rustembedded3 replies 2 retweets 19 likes -
Replying to @bascule @rustembedded
You can’t just treat generics and impl Traits as dyn. That leads to intensional type analysis which is just not worth it.
2 replies 0 retweets 4 likes -
Why can't you do dictionary passing?
1 reply 0 retweets 1 like -
Because we don't have a uniform value representation, so dictionary passing turns into intensional type analysis and it becomes a huge mess (trust me, I wrote a ton of that code back in the day).
1 reply 0 retweets 4 likes -
I guess I'm confused about why the dictionary wouldn't just be able to handle the difference.
1 reply 0 retweets 0 likes
It can, but it turns into a huge mess because there are all sorts of problems. e.g. you have to be able to create dictionaries at runtime because of types like tuple types like (T,T) and you have to make functions like “copy these bits”, “get the alignment of this type”, virtual.
-
-
https://gankra.github.io/blah/swift-abi/ has some more info
0 replies 0 retweets 1 likeThanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.