Skip to content

Conversation

@iamed2
Copy link
Contributor

@iamed2 iamed2 commented May 16, 2019

Previously, BoundsError used show when the container wasn't an AbstractArray. That could print a lot of stuff, and customizing it required changing the behaviour of show. Now it always uses summary, so users can define their own summary to customize the display here.

Also summary of a tuple now displays the whole tuple instead of its type. That's usually shorter than printing the type, and it keeps the existing behaviour for BoundsError.

@JeffBezanson JeffBezanson added the display and printing Aesthetics and correctness of printed representations of objects. label May 16, 2019
@mbauman
Copy link
Member

mbauman commented May 17, 2019

Oh, I see — this is for the printing of the "parent" object (and not the indices). Yes, this seems reasonable. Because I had to look: the default implementation of summary is simply printing the type.

@iamed2 iamed2 closed this May 27, 2019
@iamed2 iamed2 reopened this May 27, 2019
@iamed2
Copy link
Contributor Author

iamed2 commented May 27, 2019

I don't know why Travis mac is failing now but I don't think I did it

@KristofferC KristofferC merged commit 24497e8 into JuliaLang:master May 28, 2019
@iamed2 iamed2 deleted the ed/boundserror-summary branch May 28, 2019 18:23
@fredrikekre
Copy link
Member

This broke a bunch of doctests, for example it changed

julia> "α"[0]
ERROR: BoundsError: attempt to access "α"
  at index [0]

to

julia> "α"[0]
ERROR: BoundsError: attempt to access String
  at index [0]

which IMO is much worse.

@iamed2
Copy link
Contributor Author

iamed2 commented May 30, 2019

Doctests need to be added as a CI step. Is there an issue/PR for that?

@JeffBezanson
Copy link
Member

They're already run in CI, but haven't been causing builds to fail due to a bug in documenter (it just needs to be upgraded).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

display and printing Aesthetics and correctness of printed representations of objects.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants