Skip to content

Change isassigned() to match the Base definition#32

Open
JamesWrigley wants to merge 1 commit intoJuliaLang:mainfrom
JamesWrigley:isassigned
Open

Change isassigned() to match the Base definition#32
JamesWrigley wants to merge 1 commit intoJuliaLang:mainfrom
JamesWrigley:isassigned

Conversation

@JamesWrigley
Copy link
Copy Markdown
Member

ScopedValues.jl previously used isassigned() to check if a ScopedValue had a default value, but that differs from Base which uses isassigned() to check if a ScopedValue is initialized in the current scope.

Fixes this behaviour:

julia> using ScopedValues

julia> x = ScopedValue{Int}()
ScopedValue{Int64}(undefined)

julia> isassigned(x)
false

# On 1.11+ this returns true
julia> @with x => 1 isassigned(x)
false

This is technically a breaking change, but I would consider it a bugfix to match Base. It came up in the wild when using ScopedValues.jl in DistributedNext (JuliaParallel/DistributedNext.jl#17).

ScopedValues.jl previously used `isassigned()` to check if a `ScopedValue` had a
default value, but this differs from Base which uses `isassigned()` to check if
a `ScopedValue` is initialized in the current scope.
@JamesWrigley
Copy link
Copy Markdown
Member Author

(bump)

1 similar comment
@JamesWrigley
Copy link
Copy Markdown
Member Author

(bump)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant