Confused about change in axes() for v1.1

I was surprised to see that I got a new error in 1.1 that did not occur in 1.0. The culprit was this change in axes:

driscoll@~\> julia-1.0
               _
  | | |_| | | | (_| |  |  Version 1.0.3 (2018-12-18)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release

julia> axes( (1,2) )
Base.OneTo(2)
^D

driscoll@~> julia-1.1
               _
  | | |_| | | | (_| |  |  Version 1.1.0 (2019-01-21)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release

julia> axes( (1,2) )
(Base.OneTo(2),)

It seems that this change was introduced in commit 817f6fc, with the message “fix definition of axes”. I don’t see any mention of this in the 1.1.0 NEWS.md file.

Am I wrong in thinking about this as a breaking change? Why was the 1.0 behavior considered broken?

1 Like

The previous behavior was definitely a bug, but you’re right — we should have made sure to flag this as a minor change. Sorry this caught you out.

The definition of axes is to return a tuple with one axis per dimension. Tuples themselves are only one-dimensional, so it should return a tuple with one element in it. This change brings axes((1, 2)) in line with axes([1,2]).

2 Likes