Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add ismutabletype #39037

Merged
merged 1 commit into from
Dec 31, 2020
Merged

Add ismutabletype #39037

merged 1 commit into from
Dec 31, 2020

Conversation

Keno
Copy link
Member

@Keno Keno commented Dec 30, 2020

Determines whether a type was declared using mutable struct.
Naming follows from the ismutable query we already have, analogous
to isbits/isbitstype. Replaces #18168.

@Keno Keno mentioned this pull request Dec 30, 2020
"""
ismutabletype(T) -> Bool

Determine whether type `T` was declared as a struct type
Copy link
Member

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? :)

Copy link
Member Author

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)
Copy link
Member

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? :)

Copy link
Member Author

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.

Copy link
Member

@Sacha0 Sacha0 left a 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.
@Keno Keno merged commit 82d79ce into master Dec 31, 2020
@Keno Keno deleted the kf/ismutabletype branch December 31, 2020 07:00
ElOceanografo pushed a commit to ElOceanografo/julia that referenced this pull request May 4, 2021
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.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants