Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Base.show(::IO, ::T) does not return parseable Julia code for numerous types #743

Closed
brainandforce opened this issue Oct 17, 2024 · 1 comment

Comments

@brainandforce
Copy link

From the docstring of Base.show:

The representation used by show generally includes Julia-specific formatting and type information, and should be parseable Julia code when possible.

Calling show on units or unitful values provided by this package does not provide parseable Julia code for the value:

julia> show(stdout, u"km/s")
km s^-1

julia> show(stdout, 4u"km/s")
4 km s^-1

I'd expect something along the lines of

julia> show(stdout, u"km/s")
u"km * s^-1"

julia> show(stdout, 4u"km/s")
4u"km * s^-1"

Fixing this should not affect the pretty printing methods, which use show(::IO, ::MIME"text/plain", ::T).

@giordano
Copy link
Collaborator

Duplicate of #412

@giordano giordano marked this as a duplicate of #412 Oct 17, 2024
@giordano giordano closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants