-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Standardise Julia's Output Ecosystem #13751
Comments
This definitely needs some rationalization, although I don't think that |
See also #7959 |
The problem with |
I think this is covered by #5709, #7959, #29, #6117, and #9458. It would be especially helpful to comment on the proposal in #7959. I don't think show and print are especially poorly documented:
Feel free to make a pull request with suggested wording improvements. |
Fair enough, I correct my statement. The documentation of |
@ettersi if you find the time, maybe after reading through those past issues you could write such a summary? We're all volunteers of course, most of us with jobs that aren't anything to do with Julia development :D |
To a newbie like me, Julia's "object-to-string" ecosystem (functions like
print
,show
,string
, ...) appears to be quite a mess. For example, typing[1,2,3]
in the REPL calls I-don't-know-which function and printswhile
print
,show
andstring
all produce[1,2,3]
. For a symbol:a
, on the other hand, REPL andshow
result in:a
whileprint
andstring
produce onlya
without the colon. Clearly, these different output formats appeared because object-to-string conversion has different purposes in different contexts, but it is not clear to me what these contexts are and how they are mapped to the above functions. In my opinion, it would be worth to work out these contexts and document when you should use which function because of the following reasons.print
orshow
to display nested objects?Here are my thoughts on what key characteristics of to-string functions are:
show(:a) -> :a
(technical) vs.print(:a) -> a
(semantic).In my opinion:
string
should only be provided for types which can be information-preserving on a single line (e.g. numbers, symbols, expressions) and follow the semantic principle.Related:
The text was updated successfully, but these errors were encountered: