Skip to content

Commit

Permalink
doc: compat annotations, news and manual updates
Browse files Browse the repository at this point in the history
for #29790, #30496 and #30915.
  • Loading branch information
fredrikekre committed Feb 6, 2019
1 parent 9562bdf commit 020963a
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 6 deletions.
18 changes: 16 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ New library functions
---------------------

* `getipaddrs()` function returns all the IP addresses of the local machine ([#30349])
* Added `Base.hasproperty` and `Base.hasfield` ([#28850]).
* One argument `!=(x)`, `>(x)`, `>=(x)`, `<(x)`, `<=(x)` has been added for currying,
similar to the existing `==(x)` and `isequal(x)` methods ([#30915]).

Standard library changes
------------------------

* Added `Base.hasproperty` and `Base.hasfield` ([#28850]).

#### LinearAlgebra

* Added keyword arguments `rtol`, `atol` to `pinv` and `nullspace` ([#29998]).
Expand Down Expand Up @@ -68,8 +69,21 @@ Deprecated or removed


<!--- generated by NEWS-update.jl: -->
[#21598]: https://github.com/JuliaLang/julia/issues/21598
[#24980]: https://github.com/JuliaLang/julia/issues/24980
[#28850]: https://github.com/JuliaLang/julia/issues/28850
[#29998]: https://github.com/JuliaLang/julia/issues/29998
[#30061]: https://github.com/JuliaLang/julia/issues/30061
[#30200]: https://github.com/JuliaLang/julia/issues/30200
[#30298]: https://github.com/JuliaLang/julia/issues/30298
[#30323]: https://github.com/JuliaLang/julia/issues/30323
[#30349]: https://github.com/JuliaLang/julia/issues/30349
[#30372]: https://github.com/JuliaLang/julia/issues/30372
[#30583]: https://github.com/JuliaLang/julia/issues/30583
[#30584]: https://github.com/JuliaLang/julia/issues/30584
[#30593]: https://github.com/JuliaLang/julia/issues/30593
[#30618]: https://github.com/JuliaLang/julia/issues/30618
[#30670]: https://github.com/JuliaLang/julia/issues/30670
[#30712]: https://github.com/JuliaLang/julia/issues/30712
[#30724]: https://github.com/JuliaLang/julia/issues/30724
[#30915]: https://github.com/JuliaLang/julia/issues/30915
15 changes: 15 additions & 0 deletions base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -948,6 +948,9 @@ Create a function that compares its argument to `x` using [`!=`](@ref), i.e.
a function equivalent to `y -> y != x`.
The returned function is of type `Base.Fix2{typeof(!=)}`, which can be
used to implement specialized methods.
!!! compat "Julia 1.2"
This functionality requires at least Julia 1.2.
"""
!=(x) = Fix2(!=, x)

Expand All @@ -958,6 +961,9 @@ Create a function that compares its argument to `x` using [`>=`](@ref), i.e.
a function equivalent to `y -> y >= x`.
The returned function is of type `Base.Fix2{typeof(>=)}`, which can be
used to implement specialized methods.
!!! compat "Julia 1.2"
This functionality requires at least Julia 1.2.
"""
>=(x) = Fix2(>=, x)

Expand All @@ -968,6 +974,9 @@ Create a function that compares its argument to `x` using [`<=`](@ref), i.e.
a function equivalent to `y -> y <= x`.
The returned function is of type `Base.Fix2{typeof(<=)}`, which can be
used to implement specialized methods.
!!! compat "Julia 1.2"
This functionality requires at least Julia 1.2.
"""
<=(x) = Fix2(<=, x)

Expand All @@ -978,6 +987,9 @@ Create a function that compares its argument to `x` using [`>`](@ref), i.e.
a function equivalent to `y -> y > x`.
The returned function is of type `Base.Fix2{typeof(>)}`, which can be
used to implement specialized methods.
!!! compat "Julia 1.2"
This functionality requires at least Julia 1.2.
"""
>(x) = Fix2(>, x)

Expand All @@ -988,6 +1000,9 @@ Create a function that compares its argument to `x` using [`<`](@ref), i.e.
a function equivalent to `y -> y < x`.
The returned function is of type `Base.Fix2{typeof(<)}`, which can be
used to implement specialized methods.
!!! compat "Julia 1.2"
This functionality requires at least Julia 1.2.
"""
<(x) = Fix2(<, x)

Expand Down
12 changes: 8 additions & 4 deletions base/reflection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@ fieldnames(t::Type{<:Tuple}) = ntuple(identity, fieldcount(t))
"""
hasfield(T::Type, name::Symbol)
Returns a boolean indicating whether DataType has the specified field as one of
its own fields.
Return a boolean indicating whether `T` has `name` as one of its own fields.
!!! compat "Julia 1.2"
This function requires at least Julia 1.2.
"""
function hasfield(::Type{T}, name::Symbol) where T
@_pure_meta
Expand Down Expand Up @@ -1258,7 +1260,9 @@ propertynames(x, private) = propertynames(x) # ignore private flag by default
"""
hasproperty(x, s::Symbol)
Returns a boolean indicating whether the object `x` has the specified property as one of
its own properties.
Return a boolean indicating whether the object `x` has `s` as one of its own properties.
!!! compat "Julia 1.2"
This function requires at least Julia 1.2.
"""
hasproperty(x, s::Symbol) = s in propertynames(x)
6 changes: 6 additions & 0 deletions base/regex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ Return `true` if `s` starts with the regex pattern, `prefix`.
See also [`occursin`](@ref) and [`endswith`](@ref).
!!! compat "Julia 1.2"
This method requires at least Julia 1.2.
# Examples
```jldoctest
julia> startswith("JuliaLang", r"Julia|Romeo")
Expand Down Expand Up @@ -218,6 +221,9 @@ Return `true` if `s` ends with the regex pattern, `suffix`.
See also [`occursin`](@ref) and [`startswith`](@ref).
!!! compat "Julia 1.2"
This method requires at least Julia 1.2.
# Examples
```jldoctest
julia> endswith("JuliaLang", r"Lang|Roberts")
Expand Down
2 changes: 2 additions & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Base.deepcopy
Base.getproperty
Base.setproperty!
Base.propertynames
Base.hasproperty
Core.getfield
Core.setfield!
Core.isdefined
Expand Down Expand Up @@ -158,6 +159,7 @@ Base.isstructtype
Base.nameof(::DataType)
Base.fieldnames
Base.fieldname
Base.hasfield
```

### Memory layout
Expand Down

0 comments on commit 020963a

Please sign in to comment.