Skip to content

Commit

Permalink
Merge pull request #17381 from tkelman/tk/moreminordocsetc
Browse files Browse the repository at this point in the history
More minor docs, NEWS, and other little adjustments
  • Loading branch information
tkelman authored Jul 14, 2016
2 parents 6cbfe5f + 00ed7fa commit 089590b
Show file tree
Hide file tree
Showing 23 changed files with 57 additions and 90 deletions.
42 changes: 26 additions & 16 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,27 @@ Language changes
Instead of adding methods to `call`, methods are added by type using the syntax
`(::ftype)(...) = ...`. `call` is deprecated ([#13412]).

* `using` and `import` are now case-sensitive even on case-insensitive filesystems (common on Mac and Windows) ([#13542]).
* `using` and `import` are now case-sensitive even on case-insensitive filesystems
(common on Mac and Windows) ([#13542]).

* Relational symbols are now allowed as infix operators ([#8036]).

* A warning is always given when a method is overwritten (previously, this was done only when the new
and old definitions were in separate modules) ([#14759]).
* A warning is always given when a method is overwritten (previously, this was done
only when the new and old definitions were in separate modules) ([#14759]).

* `A <: B` is parsed as `Expr(:(<:), :A, :B)` in all cases ([#9503]). This also applies to the
`>:` operator.
* `A <: B` is parsed as `Expr(:(<:), :A, :B)` in all cases ([#9503]).
This also applies to the `>:` operator.

* Simple 2-argument comparisons like `A < B` are parsed as calls instead of using the
`:comparison` expression type.
`:comparison` expression type ([#15524]).

* The `if` keyword cannot be followed immediately by a line break ([#15763]).

* The built-in `NTuple` type has been removed; `NTuple{N,T}` is now
implemented internally as `Tuple{Vararg{T,N}}` ([#11242]).

* Array comprehensions preserve the dimensions of the input ranges. For example,
`[ 2x for x in A]` will have the same dimensions as `A`.
`[2x for x in A]` will have the same dimensions as `A` ([#16622]).

* The result type of an array comprehension depends only on the types of elements
computed, instead of using type inference ([#7258]). If the result is empty, then
Expand All @@ -98,7 +99,7 @@ Breaking changes

* `pmap` keyword arguments `err_retry=true` and `err_stop=false` are deprecated.
Action to be taken on errors can be specified via the `on_error` keyword argument.
Retry is specified via `retry_n`, `retry_on` and `retry_max_delay`.
Retry is specified via `retry_n`, `retry_on` and `retry_max_delay` ([#15409], [#15975], [#16663]).

* `reshape` is now defined to always share data with the original array.
If a reshaped copy is needed, use `copy(reshape(a))` or `copy!` to a new array of
Expand Down Expand Up @@ -172,7 +173,8 @@ Library improvements
* All dimensions indexed by scalars are now dropped, whereas previously only
trailing scalar dimensions would be omitted from the result ([#13612]).

* Dimensions indexed by multidimensional arrays add dimensions. More generally, the dimensionality of the result is the sum of the dimensionalities of the indices ([#15431]).
* Dimensions indexed by multidimensional arrays add dimensions. More generally, the
dimensionality of the result is the sum of the dimensionalities of the indices ([#15431]).

* New `normalize` and `normalize!` convenience functions for normalizing
vectors ([#13681]).
Expand All @@ -189,13 +191,13 @@ Library improvements
vector instead of a one-column sparse matrix. ([#13440])

* Rank one update and downdate functions, `lowrankupdate`, `lowrankupdate!`, `lowrankdowndate`,
and `lowrankdowndate!`, for dense Cholesky factorizations ([#14243], [#14424])
and `lowrankdowndate!`, for dense Cholesky factorizations ([#14243], [#14424])

* All `sparse` methods now retain provided numerical zeros as structural nonzeros; to
drop numerical zeros, use `dropzeros!` ([#14798], [#15242]).

* New `foreach` function for calling a function on every element of a collection when
the results are not needed.
the results are not needed ([#13774]).

* `Cmd(cmd; ...)` now accepts new Windows-specific options `windows_verbatim`
(to alter Windows command-line generation) and `windows_hide` (to
Expand All @@ -217,10 +219,11 @@ Library improvements
directory, instead of the private `<prefix>/lib/julia` directory ([#16362]).

* System reflection is now more consistently exposed from Sys and not Base.
`OS_NAME` has been replaced by `Sys.KERNEL` and always reports the name of the kernel (as reported by `uname`).
The `@windows_only` and `@osx` family of macros have been replaced with functions such as `is_windows()` and
or `is_apple()`. There's now also an `@static` macro that will evaluate the condition of an if-statement at
compile time, for when a static branch is required ([#16219]).
`OS_NAME` has been replaced by `Sys.KERNEL` and always reports the name of the
kernel (as reported by `uname`). The `@windows_only` and `@osx` family of macros
have been replaced with functions such as `is_windows()` and `is_apple()`.
There's now also an `@static` macro that will evaluate the condition of an
if-statement at compile time, for when a static branch is required ([#16219]).

* Prime number related functions have been moved from `Base` to the
[Primes.jl package](https://github.com/JuliaMath/Primes.jl) ([#16481]).
Expand All @@ -247,7 +250,8 @@ Deprecated or removed

* Deprecate `chol(A,Val{:U/:L})` in favor of `chol(A)` ([#13680]).

* `issym` is deprecated in favor of `issymmetric` to match similar functions (`ishermitian`, ...) ([#15192])
* `issym` is deprecated in favor of `issymmetric` to match similar functions
(`ishermitian`, ...) ([#15192])

* `scale` is deprecated in favor of either `α*A`, `Diagonal(x)*A`, or `A*Diagonal(x)`. ([#15258])

Expand Down Expand Up @@ -289,6 +293,7 @@ Deprecated or removed
[#13612]: https://github.com/JuliaLang/julia/issues/13612
[#13680]: https://github.com/JuliaLang/julia/issues/13680
[#13681]: https://github.com/JuliaLang/julia/issues/13681
[#13774]: https://github.com/JuliaLang/julia/issues/13774
[#13780]: https://github.com/JuliaLang/julia/issues/13780
[#13824]: https://github.com/JuliaLang/julia/issues/13824
[#13897]: https://github.com/JuliaLang/julia/issues/13897
Expand All @@ -307,11 +312,14 @@ Deprecated or removed
[#15242]: https://github.com/JuliaLang/julia/issues/15242
[#15244]: https://github.com/JuliaLang/julia/issues/15244
[#15258]: https://github.com/JuliaLang/julia/issues/15258
[#15409]: https://github.com/JuliaLang/julia/issues/15409
[#15431]: https://github.com/JuliaLang/julia/issues/15431
[#15524]: https://github.com/JuliaLang/julia/issues/15524
[#15550]: https://github.com/JuliaLang/julia/issues/15550
[#15609]: https://github.com/JuliaLang/julia/issues/15609
[#15731]: https://github.com/JuliaLang/julia/issues/15731
[#15763]: https://github.com/JuliaLang/julia/issues/15763
[#15975]: https://github.com/JuliaLang/julia/issues/15975
[#16058]: https://github.com/JuliaLang/julia/issues/16058
[#16107]: https://github.com/JuliaLang/julia/issues/16107
[#16219]: https://github.com/JuliaLang/julia/issues/16219
Expand All @@ -322,7 +330,9 @@ Deprecated or removed
[#16455]: https://github.com/JuliaLang/julia/issues/16455
[#16481]: https://github.com/JuliaLang/julia/issues/16481
[#16621]: https://github.com/JuliaLang/julia/issues/16621
[#16622]: https://github.com/JuliaLang/julia/issues/16622
[#16645]: https://github.com/JuliaLang/julia/issues/16645
[#16663]: https://github.com/JuliaLang/julia/issues/16663
[#16731]: https://github.com/JuliaLang/julia/issues/16731
[#16972]: https://github.com/JuliaLang/julia/issues/16972
[#17037]: https://github.com/JuliaLang/julia/issues/17037
Expand Down
1 change: 1 addition & 0 deletions base/clusterserialize.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

import .Serializer: known_object_data, object_number, serialize_cycle, deserialize_cycle, writetag,
__deserialized_types__, serialize_typename_body, deserialize_typename_body,
TYPENAME_TAG, object_numbers
Expand Down
2 changes: 2 additions & 0 deletions base/dates/rounding.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

# The epochs used for date rounding are based ISO 8601's "year zero" notation
const DATEEPOCH = value(Date(0))
const DATETIMEEPOCH = value(DateTime(0))
Expand Down
8 changes: 4 additions & 4 deletions base/docs/helpdb/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1455,9 +1455,9 @@ current `include` path but does not use it to search for files (see help for `in
This function is typically used to load library code, and is implicitly called by `using` to
load packages.
When searching for files, `require` first looks for package code under `Pkg.dir()`, then tries
paths in the global array `LOAD_PATH`. `require` is case-sensitive on all
platforms including those with case-insensitive filesystems like macOS and
When searching for files, `require` first looks for package code under `Pkg.dir()`,
then tries paths in the global array `LOAD_PATH`. `require` is case-sensitive on
all platforms, including those with case-insensitive filesystems like macOS and
Windows.
"""
require
Expand Down Expand Up @@ -4080,7 +4080,7 @@ rand
Convert an integer to a string in the given base, optionally specifying a number of digits to pad to.
"""
base(base, n, pad)
base

"""
BoundsError([a],[i])
Expand Down
1 change: 0 additions & 1 deletion base/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,6 @@ export
TextDisplay,
istextmime,
MIME,
@MIME,
@MIME_str,
reprmime,
stringmime,
Expand Down
2 changes: 1 addition & 1 deletion base/linalg/factorization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end
"""
A_ldiv_B!([Y,] A, B) -> Y
Compute `A \ B` in-place and store the result in `Y`, returning the result.
Compute `A \\ B` in-place and store the result in `Y`, returning the result.
If only two arguments are passed, then `A_ldiv_B!(A, B)` overwrites `B` with
the result.
Expand Down
4 changes: 2 additions & 2 deletions base/range.jl
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ end
-(r::FloatRange) = FloatRange(-r.start, -r.step, r.len, r.divisor)
-(r::LinSpace) = LinSpace(-r.start, -r.stop, r.len, r.divisor)

.+(x::Real, r::AbstractUnitRange) = range(x + first(r), length(r))
.+(x::Real, r::AbstractUnitRange) = range(x + first(r), length(r))
.+(x::Real, r::Range) = (x+first(r)):step(r):(x+last(r))
#.+(x::Real, r::StepRange) = range(x + r.start, r.step, length(r))
.+(x::Real, r::FloatRange) = FloatRange(r.divisor*x + r.start, r.step, r.len, r.divisor)
Expand All @@ -678,7 +678,7 @@ function .-(x::Real, r::LinSpace)
x2 = x * r.divisor / (r.len - 1)
LinSpace(x2 - r.start, x2 - r.stop, r.len, r.divisor)
end
.-(r::AbstractUnitRange, x::Real) = range(first(r)-x, length(r))
.-(r::AbstractUnitRange, x::Real) = range(first(r)-x, length(r))
.-(r::StepRange , x::Real) = range(r.start-x, r.step, length(r))
.-(r::FloatRange, x::Real) = FloatRange(r.start - r.divisor*x, r.step, r.len, r.divisor)
function .-(r::LinSpace, x::Real)
Expand Down
1 change: 1 addition & 0 deletions base/sharedarray.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

import .Serializer: serialize_cycle, serialize_type, writetag, UNDEFREF_TAG

type SharedArray{T,N} <: DenseArray{T,N}
Expand Down
3 changes: 3 additions & 0 deletions contrib/add_license_to_files.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const skipfiles = [
"../src/abi_x86.cpp",
"../src/abi_x86_64.cpp",
"../src/disasm.cpp",
"../src/getopt.c",
"../src/getopt.h",
"../src/support/END.h",
"../src/support/ENTRY.amd64.h",
"../src/support/ENTRY.i387.h",
Expand All @@ -54,6 +56,7 @@ const skipfiles = [
"../src/support/strtod.c",
"../src/support/tzfile.h",
"../src/support/utf8.c",
"../test/perf/micro/randmtzig.c",
]

const ext_prefix = Dict([
Expand Down
8 changes: 0 additions & 8 deletions doc/devdocs/ast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,6 @@ These symbols appear in the ``head`` field of ``Expr``\s in lowered form.
``null``
has no arguments; simply yields the value ``nothing``

``static_typeof``
a horrible misfeature used to determine the result type of array
comprehensions. Planned to be removed.

``type_goto``
a virtual control flow edge used to convey type data to ``static_typeof``,
also to be removed.

``new``
allocates a new struct-like object. First argument is the type. The ``new``
pseudo-function is lowered to this, and the type is always inserted by the
Expand Down
2 changes: 1 addition & 1 deletion doc/manual/dates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ default, the :class:`TimeType` :func:`round` method uses the ``RoundNearestTiesU
rounding mode. (It's difficult to guess what breaking ties to nearest "even"
:class:`TimeType` would entail.) Further details on the available ``RoundingMode`` s can
be found in the
`API reference <http://docs.julialang.org/en/latest/stdlib/dates/#rounding-functions>`_.
`API reference <http://docs.julialang.org/en/latest/stdlib/dates/>`_.

Rounding should generally behave as expected, but there are a few cases in which the
expected behaviour is not obvious.
Expand Down
4 changes: 2 additions & 2 deletions doc/manual/noteworthy-differences.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ some noteworthy differences that may trip up Julia users accustomed to MATLAB:
- In MATLAB, an idiomatic way to remove unwanted values is to use logical
indexing, like in the expression ``x(x>3)`` or in the statement
``x(x>3) = []`` to modify ``x`` in-place. In contrast, Julia provides the
higher order functions :func:`filter` and a :func:`filter!`, allowing users
higher order functions :func:`filter` and :func:`filter!`, allowing users
to write ``filter(z->z>3, x)`` and ``filter!(z->z>3, x)`` as alternatives to
the corresponding transliterations ``x[x.>3]`` and ``x = x[x.>3]``. Using
:func:`filter!` reduces the use of temporary arrays.
Expand Down Expand Up @@ -235,7 +235,7 @@ noteworthy differences:
- In R, an idiomatic way to remove unwanted values is to use logical indexing,
like in the expression ``x[x>3]`` or in the statement ``x = x[x>3]`` to
modify ``x`` in-place. In contrast, Julia provides the higher order functions
:func:`filter` and a :func:`filter!`, allowing users to write
:func:`filter` and :func:`filter!`, allowing users to write
``filter(z->z>3, x)`` and ``filter!(z->z>3, x)`` as alternatives to the
corresponding transliterations ``x[x.>3]`` and ``x = x[x.>3]``. Using
:func:`filter!` reduces the use of temporary arrays.
Expand Down
45 changes: 0 additions & 45 deletions doc/manual/performance-tips.rst
Original file line number Diff line number Diff line change
Expand Up @@ -947,51 +947,6 @@ Taken to its extreme, pre-allocation can make your code uglier, so
performance measurements and some judgment may be required.


Use parentheses in long arithmetic operations
---------------------------------------------

If your code has a long arithmetic operation involving ``+`` or ``*`` operators,
then consider using parentheses to chain up to four or five operations together.
This is to avoid the splatting penalty from a longer list of arguments to function
return statement.

Without parentheses:

const k = zeros(20)
function test_mem()
return k[1] + k[2] + k[3] + k[4] + k[5] + 2.0 * k[6] + k[7] + k[8] + k[9] + k[10]
end

function test(n::Int64)
ret = 0.0
for i = 1:n
ret += test_mem()
end
ret
end
@time test(100000000)

5.017971 seconds (900.00 M allocations: 13.411 GB, 15.04% gc time)

With:

const k = zeros(20)
function test_mem()
return (k[1] + k[2] + k[3] + k[4] + k[5]) + 2.0 * k[6] + k[7] + k[8] + k[9] + k[10]
end

function test(n::Int64)
ret = 0.0
for i = 1:n
ret += test_mem()
end
ret
end
@time test(100000000)

0.302478 seconds (5.26 k allocations: 248.985 KB)


Avoid string interpolation for I/O
----------------------------------

Expand Down
2 changes: 1 addition & 1 deletion doc/stdlib/base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Getting Around

Loads a source files, in the context of the ``Main`` module, on every active node, searching standard locations for files. ``require`` is considered a top-level operation, so it sets the current ``include`` path but does not use it to search for files (see help for ``include``\ ). This function is typically used to load library code, and is implicitly called by ``using`` to load packages.

When searching for files, ``require`` first looks for package code under ``Pkg.dir()``\ , then tries paths in the global array ``LOAD_PATH``\ . ``require`` is case-sensitive on all platforms including those with case-insensitive filesystems like macOS and Windows.
When searching for files, ``require`` first looks for package code under ``Pkg.dir()``\ , then tries paths in the global array ``LOAD_PATH``\ . ``require`` is case-sensitive on all platforms, including those with case-insensitive filesystems like macOS and Windows.

.. function:: Base.compilecache(module::String)

Expand Down
2 changes: 1 addition & 1 deletion doc/stdlib/linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ according to the usual Julia convention.

.. Docstring generated from Julia source
Compute ``A B`` in-place and store the result in ``Y``\ , returning the result. If only two arguments are passed, then ``A_ldiv_B!(A, B)`` overwrites ``B`` with the result.
Compute ``A \ B`` in-place and store the result in ``Y``\ , returning the result. If only two arguments are passed, then ``A_ldiv_B!(A, B)`` overwrites ``B`` with the result.

The argument ``A`` should *not* be a matrix. Rather, instead of matrices it should be a factorization object (e.g. produced by :func:`factorize` or :func:`cholfact`\ ). The reason for this is that factorization itself is both expensive and typically allocates memory (although it can also be done in-place via, e.g., :func:`lufact!`\ ), and performance-critical situations requiring ``A_ldiv_B!`` usually also require fine-grained control over the factorization of ``A``\ .

Expand Down
2 changes: 0 additions & 2 deletions src/common_symbols2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,9 @@ jl_symbol("#print_to_string#138"),
jl_symbol("Main"),
jl_symbol("pointer.jl"),
jl_symbol("DimensionMismatch"),
jl_symbol("type_goto"),
jl_symbol("stride"),
jl_symbol("uP"),
jl_symbol("III"),
jl_symbol("static_typeof"),
jl_symbol("uW"),
jl_symbol("checked_trunc_uint"),
jl_symbol("sparse/sparsematrix.jl"),
Expand Down
6 changes: 3 additions & 3 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,10 @@ static void jl_serialize_datatype(ios_t *s, jl_datatype_t *dt)
}

write_int32(s, dt->size);
int has_instance = !!(dt->instance != NULL);
int has_layout = !!(dt->layout != NULL);
int has_instance = (dt->instance != NULL);
int has_layout = (dt->layout != NULL);
write_uint8(s, dt->abstract | (dt->mutabl<<1) | (has_layout<<2) | (has_instance<<3) |
(dt->hastypevars<<4) | (dt->haswildcard<<5) | (dt->isleaftype<<6));
(dt->hastypevars<<4) | (dt->haswildcard<<5) | (dt->isleaftype<<6));
write_int32(s, dt->depth);
if (!dt->abstract) {
write_uint16(s, dt->ninitialized);
Expand Down
2 changes: 2 additions & 0 deletions src/jloptions.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// This file is a part of Julia. License is MIT: http://julialang.org/license

#include <limits.h>

#include "julia.h"
Expand Down
2 changes: 1 addition & 1 deletion src/toplevel.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ static void jl_module_load_time_initialize(jl_module_t *m)
jl_module_init_order = jl_alloc_vec_any(0);
jl_array_ptr_1d_push(jl_module_init_order, (jl_value_t*)m);
jl_function_t *f = jl_module_get_initializer(m);
if (f != NULL) {
if (f != NULL) {
jl_value_t *tt = jl_is_type(f) ? (jl_value_t*)jl_wrap_Type(f) : jl_typeof(f);
JL_GC_PUSH1(&tt);
tt = (jl_value_t*)jl_apply_tuple_type_v(&tt, 1);
Expand Down
2 changes: 2 additions & 0 deletions test/cartesian.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

@test Base.Cartesian.exprresolve(:(1 + 3)) == 4
ex = Base.Cartesian.exprresolve(:(if 5 > 4; :x; else :y; end))
@test ex.args[2] == QuoteNode(:x)
2 changes: 1 addition & 1 deletion test/ccall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ elseif Sys.ARCH === :powerpc64le || Sys.ARCH === :ppc64le
(14, 13, 12, 11), (15, 14, 13, 12), (16, 15, 14, 13), (17, 16, 15, 14), (18, 17, 16, 15),
(1024, 1023, 1022, 1021), (1025, 1024, 1023, 1022), (1026, 1025, 1024, 1023), (1027, 1026, 1025, 1024), (10028, 10027, 10026, 10025))

else
elseif Sys.ARCH !== :i686 && Sys.ARCH !== :arm # TODO
warn("ccall: no VecReg tests run for this platform")

end
Expand Down
2 changes: 2 additions & 0 deletions test/dates/rounding.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

# Test conversion to and from the rounding epoch (ISO 8601 year 0000)
@test Dates.epochdays2date(-1) == Dates.Date(-1, 12, 31)
@test Dates.epochdays2date(0) == Dates.Date(0, 1, 1)
Expand Down
Loading

0 comments on commit 089590b

Please sign in to comment.