Unfortunately even Rust can violate parametricity due to the (very limited) use of specialization in the standard library implementation to optimize certain cases. It would be nice if specialization was only allowed when you have an Any-like bound on the type parameter, which should retain parametricity. The downside is that you can't add specialization after the fact without changing the API. You could maybe salvage that by making it a default bound with an opt-out like Sized vs ?Sized.
=> More informations about this toot | View the thread | More toots from pervognsen@mastodon.social
text/gemini
This content has been proxied by September (3851b).