I was wondering how I should declare a function parameter that takes a small Copy type such as char or f32. (I consider a type small if size_of_type <= 2 * size_of_pointer)
I found this post, but still don't know how stdlib choose between self and &self for a small Copy type.
I believe it's just an unfortunate inconsistency that nobody caught when the is_ascii_* methods were stabilized in 1.24 All of them take &self while their older unicode counterparts take self.
As a relative newcomer to Rust I’m wondering what options Rust has for fixing this kind of thing
My understanding is that backwards compatibility is generally maintained at almost any cost
Does this mean that small consistency issues that creep into the standard library like this will gradually build up forever or is there any potential for fixing things in a new edition for example?
I guess in certain cases new methods could be introduced and the old ones deprecated, but I imagine that wouldn’t be appropriate in all cases
I'm on libs-api. Compatibility IMO means we ought to be okay with small warts here and there. This is probably one of those.
We do deprecate-and-add-new-APIs in some cases. Unless this particular inconsistency is causing a big problem (I don't think it is), then this is probably not one of those cases. The downsides of deprecating all of the is_ascii methods on char seem like they definitively eclipse any upsides of smoothing out the consistency in the method signatures.