Skip to content
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

fewer convert methods for Missing and Nothing (take 2) #31602

Merged
merged 1 commit into from
Aug 13, 2019

Conversation

vtjnash
Copy link
Sponsor Member

@vtjnash vtjnash commented Apr 3, 2019

And use typesubtract instead of subtyping to improve usability by handling undef sparams.

closes #30205

@JeffBezanson
Copy link
Sponsor Member

Do we need to add something to be able to infer typesubtract?

@ararslan ararslan added domain:missing data Base.missing and related functionality domain:types and dispatch Types, subtyping and method dispatch labels Apr 3, 2019
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 4, 2019

It apparently seems to be working ok already

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Apr 15, 2019

Should we go with this, or at least bring up in triage it?

@JeffBezanson
Copy link
Sponsor Member

Doesn't seem urgent. I would also like to understand how we're able to infer typesubtract...

@vtjnash
Copy link
Sponsor Member Author

vtjnash commented May 9, 2019

Now that we've branched, can we land this on master and see how well it works out? I didn't intend for inference to handle typesubtract, but this happens to be one of the easiest cases for it anyways (the arguments end up predictably taking the form Union{typesubtract(Missing, Missing)==>Union{}, typesubtract(T, Missing)==>T}==>T)

base/some.jl Outdated Show resolved Hide resolved
@vtjnash vtjnash force-pushed the jn/jb/convertmissingnothing branch from 1fb2e92 to 09be236 Compare May 9, 2019 23:27
base/missing.jl Outdated Show resolved Hide resolved
vtjnash added a commit that referenced this pull request Jul 16, 2019
addresses and issue where we might be ambigous with other badly designed methods
such as the ambiguous Nothing/Missing rules (cf #31602)
vtjnash added a commit that referenced this pull request Jul 23, 2019
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
vtjnash added a commit that referenced this pull request Aug 3, 2019
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
vtjnash added a commit that referenced this pull request Aug 3, 2019
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
And use `typesubtract` instead of subtyping
to improve usability by handling undef sparams.

Co-Authored-By: Jameson Nash <[email protected]>
@vtjnash vtjnash force-pushed the jn/jb/convertmissingnothing branch from 09be236 to 3888a6c Compare August 6, 2019 21:06
@vtjnash
Copy link
Sponsor Member Author

vtjnash commented Aug 6, 2019

I'd like to land this before the feature freeze (although I suppose it should be non-breaking anyways), and give it some time to see how it works out in practice since it seems to need many fewer methods and just handles them with more ease.

@StefanKarpinski StefanKarpinski added this to the 1.3 milestone Aug 7, 2019
@vtjnash vtjnash mentioned this pull request Aug 8, 2019
@vtjnash vtjnash merged commit 71b63f3 into master Aug 13, 2019
@delete-merged-branch delete-merged-branch bot deleted the jn/jb/convertmissingnothing branch August 13, 2019 18:04
@@ -163,6 +163,7 @@ true
"""
function convert end

convert(::Type{Union{}}, x) = throw(MethodError(convert, (Union{}, x)))
Copy link
Sponsor Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this here to give a predictable ambiguity error instead of an ambiguity error involving two random methods? I suppose that's fine, just wondering if there is any other reason.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you say, "predictability" :)

vtjnash added a commit that referenced this pull request Aug 16, 2019
addresses an issue where we might be find an ambiguity with badly designed methods,
such as the ambiguous Nothing/Missing rules (cf #31602)
vtjnash added a commit that referenced this pull request Jul 11, 2022
This should make it impossible to accidentally define or call this
method on foreign types.

Refs: #31602
Fixes: #45837
Closes: #45051
KristofferC pushed a commit that referenced this pull request Jul 18, 2022
This should make it impossible to accidentally define or call this
method on foreign types.

Refs: #31602
Fixes: #45837
Closes: #45051
ffucci pushed a commit to ffucci/julia that referenced this pull request Aug 11, 2022
This should make it impossible to accidentally define or call this
method on foreign types.

Refs: JuliaLang#31602
Fixes: JuliaLang#45837
Closes: JuliaLang#45051
pcjentsch pushed a commit to pcjentsch/julia that referenced this pull request Aug 18, 2022
This should make it impossible to accidentally define or call this
method on foreign types.

Refs: JuliaLang#31602
Fixes: JuliaLang#45837
Closes: JuliaLang#45051
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:missing data Base.missing and related functionality domain:types and dispatch Types, subtyping and method dispatch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants