-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
make Char not an Integer? #5844
Comments
We like to avoid equating strings and numbers. We could make conversion to Generally it would be nice to make |
I think we should just define: bool(x::Char) = throw(ArgumentError("can't convert Char to Bool")) |
I think we should just delete the |
However there is still |
Yeah, probably better to get rid of |
Well, the |
Actually, this is probably another case where the |
If we change our integer conversions to check for overflow, then converting to Bool would only allow arguments equal to 0 or 1. |
Is it intended that Bool conversions are still unchecked? |
For now yes, but I'm not totally sure what to do about it. Being non-zero is well established to correspond to trueness. However I'm not sure what the use cases are for conversion to |
Closed by #8816. |
Right now,
bool("0")
causesERROR: no method bool(ASCIIString)
. It might make sense to define it as bool(x::String) = bool(int(x)).Also, bool('0') somewhat surprisingly returns
true
, because it's dispatching to bool(::Number). It probably makes more sense to either have that return false or raise an error.The text was updated successfully, but these errors were encountered: