-
-
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
Add ismutabletype
#39037
Add ismutabletype
#39037
Conversation
base/reflection.jl
Outdated
""" | ||
ismutabletype(T) -> Bool | ||
|
||
Determine whether type `T` was declared as a struct type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct type
-> mutable struct type
I think? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
This function requires at least Julia 1.7. | ||
""" | ||
function ismutabletype(@nospecialize(t::Type)) | ||
t = unwrap_unionall(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The similar isstructtype
and isprimitivetype
definitions below seem to be at-pure; should this definition be as well? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compiler should be able to prove that itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great modulo the Union
conundrum! Thanks Keno! :)
Determines whether a type was declared using `mutable struct`. Naming follows from the `ismutable` query we already have, analogous to `isbits`/`isbitstype`. Replaces #18168.
d07adb1
to
e66ef7f
Compare
Determines whether a type was declared using `mutable struct`. Naming follows from the `ismutable` query we already have, analogous to `isbits`/`isbitstype`. Replaces JuliaLang#18168.
Determines whether a type was declared using
mutable struct
.Naming follows from the
ismutable
query we already have, analogousto
isbits
/isbitstype
. Replaces #18168.