Good point.
"5" == 5
"⑤" == 5
"⑸" == 5
"⁵" == 5
"𝟝" == 5
"𝟓" == 5
"𝟻" == 5
"V" == 5
"Ⅴ" == 5
"𝍸" == 5 # https://unicode-table.com/en/1D378/
"𐄋" == 5 # https://unicode-table.com/en/1010B/
"৫" == 5 # https://unicode-table.com/en/09EB/
If you think the first should work, you should justify why the others shouldn't.> Accepting both a numerical user id and a username string is a very valid scenario. However, I believe you should handle that by explicitly trying to parse it as a number, not hoping that automatic coercion will do the right thing. It's just a footgun waiting to go off.
This is why many people recommend questioning the use of basic or naked types. Details vary between the language, but this should be a type UserID with a UserID::from(String) and maybe a UserID::from_symbolic_name(String) and everything but some edge code should work on UserIDs. This makes code easier to read, too.
Accepting both a numerical user id and a username string is a very valid scenario. However, I believe you should handle that by explicitly trying to parse it as a number, not hoping that automatic coercion will do the right thing. It's just a footgun waiting to go off.