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".
Because doing so is a giant mess. I wrote a lot of that code early on. I highly suspect that if we did it again it would be just as slow as interpreting the whole function.
-
-
I'm not 100% sure but I believe C# does it that way for reference types (i.e. size is the same, but any behavior gets forwarded via the interface). They don't do it that way for value types (where size can differ), so maybe that's a clue.
-
I don't really understand why having variable size for the type makes it so much harder to share impl, but I guess it must be or they would do it the same for value types too (unless they do and I just misunderstood).
- 5 more replies
New conversation -
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.