Skip to content
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

Newlines in two-argment show #915

Closed
andreasnoack opened this issue Apr 14, 2021 · 0 comments
Closed

Newlines in two-argment show #915

andreasnoack opened this issue Apr 14, 2021 · 0 comments

Comments

@andreasnoack
Copy link
Contributor

These should be avoided in e.g.

Optim.jl/src/types.jl

Lines 134 to 143 in adc5b27

function Base.show(io::IO, o::Optim.Options)
for k in fieldnames(typeof(o))
v = getfield(o, k)
if v isa Nothing
@printf io "%24s = %s\n" k "nothing"
else
@printf io "%24s = %s\n" k v
end
end
end
according the the show docs. Only the three-argument show methods should have newlines.

gwater referenced this issue in gwater/Optim.jl Jan 20, 2022
Re-implement two-argument Base.show() such that it produces an executable string of Optim.Options() as specified in Base docs [1].

Move previous implementation to three-argument Base.show() which should be human-readable [2].

[1] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any}
[2] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any,%20Any}

Refs: #915
gwater referenced this issue in gwater/Optim.jl Jan 20, 2022
gwater referenced this issue in gwater/Optim.jl Jan 24, 2022
Re-implement two-argument Base.show() such that it produces an executable string of Optim.Options() as specified in Base docs [1].

Move previous implementation to three-argument Base.show() which should be human-readable [2].

[1] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any}
[2] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any,%20Any}

Refs: #915
pkofod pushed a commit that referenced this issue Feb 4, 2022
* fix(test): Types testset

* feat(test): Enable testset Types

* fix(show)!: produce executable string for Options

Re-implement two-argument Base.show() such that it produces an executable string of Optim.Options() as specified in Base docs [1].

Move previous implementation to three-argument Base.show() which should be human-readable [2].

[1] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any}
[2] https://docs.julialang.org/en/v1/base/io-network/#Base.show-Tuple{IO,%20Any,%20Any}

Refs: #915

* fix(test): add coverage for three-argument show
@pkofod pkofod closed this as completed Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants