-
-
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
grabbag of subtyping punchlist items #20407
Conversation
doc/src/manual/types.md
Outdated
@@ -1045,6 +1045,10 @@ end | |||
Of course, this depends on what `Int` is aliased to -- but that is predefined to be the correct | |||
type -- either `Int32` or `Int64`. | |||
|
|||
(Note that unlike `Int`, `Float` does not exist as a type-alias for a specific sized `AbstractFloat`. | |||
Unlike with integer registers, the size of the floating point representation is problem dependent, |
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.
Integer sizes often need to be problem dependent too, I'm not sure this is the right wording to justify this.
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.
Hm. Maybe I should say something along the lines of "the floating point register sizes are standardized across CPUs based on the IEEE-754 standard."?
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.
practically speaking I'd say that's more accurately the reason
doc/src/stdlib/punctuation.md
Outdated
@@ -42,3 +42,6 @@ Extended documentation for mathematical symbols & functions is [here](@ref math- | |||
| `::` | type annotation, depending on context | | |||
| `:( )` | quoted expression | | |||
| `:a` | symbol a | | |||
| `<:` | [`subtype operator`](@ref <:) | | |||
| `>:` | [`supertype operator`](@ref >:) (reverse of subtype operator) | | |||
| `===` | [`eqal comparison operator`](@ref ===) | |
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.
eqal or egal?
base/show.jl
Outdated
#The same as `IOContext(io::IO, KV::Pair)`, but accepting properties as keyword arguments. | ||
#""" | ||
#IOContext(io::IO; kws...) = IOContext(IOContext(io); kws...) | ||
#function IOContext(io::IOContext; kws...) |
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.
this might break Documenter, Juno, IJulia, SHA and others, is it possible to deprecate this?
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.
Not easily. The problem is that it replaces the primitive IOContext(io)
constructor (which would otherwise be inlined), with several kwarg calls. (since the kwarg method needs to be the same as the no-keyword args function)
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.
So the commit message should say "remove keyword argument IOContext
constructors". That's a pretty sneaky thing to combine with an implementation-only change.
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.
Seriously – this is not non-breaking...
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.
you mean sneaky like the commit message that added the alternate constructor? "use IOContext more consistently" (ce23174)
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.
Unfortunately there's a ratchet effect. Adding a feature or method doesn't break anything, but removing one does.
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.
Also, why does the performance of this constructor matter?
|
||
Supertype operator, equivalent to `issubtype(T2, T1)`. | ||
""" | ||
const (>:)(a::ANY, b::ANY) = issubtype(b, a) |
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 believe this needs special inference support to be able to infer Const(true)
or Const(false)
.
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.
Probably doable, and perhaps not a bad idea anyways (so that it doesn't attempt to actually specialize on any arguments that it sees). I guess the idea is that it's preferable to ensure >:
and <:
behave the same. Should I make both of them (issupertype
) builtins to keep it identical, or just make it close enough via inference?
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'd rather not add more builtins; let's just add it to inference.
base/show.jl
Outdated
#The same as `IOContext(io::IO, KV::Pair)`, but accepting properties as keyword arguments. | ||
#""" | ||
#IOContext(io::IO; kws...) = IOContext(IOContext(io); kws...) | ||
#function IOContext(io::IOContext; kws...) |
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.
So the commit message should say "remove keyword argument IOContext
constructors". That's a pretty sneaky thing to combine with an implementation-only change.
22534b4
to
90357c3
Compare
...by removing it. This type can't be represented in Julia correctly, but it also isn't needed.
Since UnionAll bounds are encountered recursively, it's easiest to represent this the same way in the IOContext. Also avoid the performance / allocation overhead of using `IOContext(io)` as a no-op convert (not a no-op since keyword support was added)
the previous version was effectively equivalent, but did more work than necessary and could fail in the wrong direction in the unlikely case that `ambi` was not a strict subtype of `mambig->sig`.
Seems to be a common FAQ. Not sure if those users would have seen it here, but it's right after explaining the existance of the `Int` type-alias.
…yping relationships
the general inliner is better and also respects effect_free (related to #9765, although none of these specific cases were mentioned there)
90357c3
to
0c819fe
Compare
bump |
test/show.jl
Outdated
@@ -569,7 +569,7 @@ let repr = sprint(dump, Any) | |||
@test length(repr) > 100000 | |||
@test ismatch(r"^Any\n [^ \t\n]", repr) | |||
@test endswith(repr, '\n') | |||
@test_broken contains(repr, " Base.Vector{T} = Array{T,1}\n") | |||
@test contains(repr, " Base.Vector{T} = Array{T,1} where T\n") |
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.
It would be more accurate print either Base.Vector = Array{T,1} where T
or Base.Vector{T} = Array{T,1}
. That second syntax will be added soon.
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.
done
LGTM. |
@nanosoldier |
Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels |
the comprehension slowdown there looks like it could be real |
From the list in #19998. Will check those off when this is merged.