Hacker News new | ask | show | jobs
by tialaramex 1847 days ago
That sounds more like Python's from future import behaviour.

What Rust does about this specific problem is that nobody else gets to mess with your stuff. For the exceptional case of the built-in types the core and I believe also std (the standard library) are allowed to define things for those types but nobody else can.

So you can't add an is_stupid() const boolean method for the char built-in that classifies Unicode scalar values by whether they are (in your opinion) stupid or not.

You could invent your own trait named Stupid with the is_stupid() method, and you can implement that trait on the built-in char type, but only people who explicitly want your Stupid trait get this behaviour. They aren't infected just by happening to use some other features you implemented.