-
-
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
proposed cleanup of output functions #7959
Comments
+1 |
+100 |
Also,
|
I suppose we could have |
So |
Yes, I was thinking |
SGTM |
Yeah, I think |
As long as we get rid of It's possible one of the MIME parameters could be 0 - just a brief summary ( |
A "level of detail" options seems fine to me for options that are mutually exclusive and can be reasonably ordered. We can define constants for these to make them more readable. (And we can always change it to a floating-point value if we want more resolution, which additionally gives us the option of |
|
Would it make sense to distinguish real |
Could we cater for nested indentation in the new system? To print nested |
I suppose we could have an My feeling is that a more robust solution would be for array printing (etc.) to print sub-objects to a buffer, and then post-process the buffer to add indenting. We could add some helper functions for this. |
…Any dictionary of properties for #7959
What's the rationale for For one thing, mime type and compactness seem like completely orthogonal concepts. The idea of a compact representation makes sense whether you're outputting to image or HTML or whatever, so why tie it to specific mime types? If you don't care about binary representation and call a higher level method like |
Also, if you want to be cute, how about using call overloading: MIME"text/plain"(io, x) |
The use of MIME as a parametrised "format specification" object seems like a good one, it can be passed repeatedly without enumerating the args, but maybe it should have a different name to MIME? |
#9633 is somewhat related. |
MIME types are used to specify the format (compactness is part of the format), and MIME types can already carry options. |
Compactness may be part of the format but it's not part of the mime type. The object you have there isn't a mime type, it's a formatting specification with a mime as a type parameter, My issue is that this design forces the formatting specification to include a mime type. This makes sense for |
Is/should there be a mime type for writing to the terminal? |
We use |
So this is in display? It's not clear how "topmost applicable" is decided (what your supposed to do to sneak something higher in their):
I see that markdown (for example), overrides |
Superseded by #14052 |
A proposal to address #5709, #6493, #4117, #3932, and similar, discussed with @JeffBezanson and @stevengj today:
writemime(io, m::MIME, x)
towrite(io, m, x)
show
in favor ofwrite
: haveshow(io, x)
callwrite(io, MIME("text/plain"), x)
, and document overridingwrite
as the preferred mechanism to customize output going forward. But don't actually deprecateshow
until Julia 0.5 or later to minimize package breakage. (Rationale:show
is confusing because it sounds likedisplay
, but it behaves more likewrite
.)MIME
objects (show
can then subsumeshowall
,showcompact
, etc with custom-specifiable precisions). For example,write(io, MIME"text/plain"(compact=true), x)
instead ofshowcompact
.As an implementation detail, we would want a fast way to represent MIME parameters as some kind of associative type in the
MIME
object. Perhaps a simpleAssociative{Symbol,V}
type which uses linear search instead of a hash table. The same type could then be used for keyword arguments.The text was updated successfully, but these errors were encountered: