-
Notifications
You must be signed in to change notification settings - Fork 370
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
Improve inference in vcat
#2559
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6927f23
Improve inference in `vcat`
timholy 33d53f3
restrict new signature to >=1.5
timholy acd7ee9
Avoid the type-parameter shenanigans
timholy 107294a
standardize on AbstractDataFrame
timholy 96ba775
Simplify a couple of signatures
timholy 2a40aee
Update src/abstractdataframe/abstractdataframe.jl
timholy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why calling
@isfefined(DF)
is required here?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.
Tuple inputs with 2 or more different types.
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.
But then
isconcretetype(DF)
should returnfalse
- right? (or would it error)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.
If I take the
@isdefined
check out and preface that conditional with a@show typeof(dfs)
, here's what I get from running thecat.jl
test:So as soon as it gets a heterogeneous tuple (one has an
Index
and the other aSubIndex
), it throws anUndefVarError
.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.
But what I do not understand is the fact that you use
DF <: AbstractDataFrame
(instead of the original implementation). And if I try to do a MWE I get:so it seems that the pattern
Tuple{Vararg{DF}} where DF <: AbstractDataFrame
is not the same as the original and intendedTuple{Vararg{AbstractDataFrame}}
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.
Yes, this seems to exploit a relatively recent & subtle change in how type parameters. Basically the
Tuple{Vararg{DF}}
is requiring a single concrete value to setDF
, but signature matching is the same as<:AbstractDataFrame
. EDIT: but your example shows the matching is incomplete.Another way we could do this is nominal-runtime:
Do you like that better?
My workflow for these things isn't very deliberative; I typically write it first without the
@isdefined
, and then when I get an error like the one above I add@isdefined
. If yougrep
this inBase
you'll see quite a few similar uses.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.
Oh dear, now I see your point with the two different
df
s. Very interesting. I'll do the runtime version perhaps.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.
I would separate
AbstractVector
andTuple
implementations then.Also for
Tuple
please make sure that in the run-time version a case when the tuple is empty is correctly handled.I have now noticed a subtle bug that should be fixed:
To be decided if we keep:
or also error here.
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.
That is weird. It does match in situ, even though your example fails for me. 😕
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.
can you show me the output of the same commands in the fresh Julia session (and what Julia are you using I am on 1.5.3). Thank you! (extending functions from Base is hard)