-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
introduce a function to check whether a value can be represented as a type #55150
Comments
I'm having a hard time understanding what this might mean in general. Is |
For the first example, one may use |
I'm imagining types that implement My starting point is that types are very similar to set of values, and thus Maybe "can be converted to" would be another way of thinking about this. |
But it's gotta consider more than just My point is more general than the examples I gave — This could be a useful operation to have, but I don't think it should be called |
Perhaps this would be a natural extension of |
x in Int32
etc.
It would be nice if one could write
x in Int32
etc. to check whether the value ofx
can be represented asInt32
. This would be implemented asmimicking
in(x::Real, r::AbstractRange{<:Real})
.Note that this is different from
x isa Int32
, which checks the type ofx
, not its value.The text was updated successfully, but these errors were encountered: