-
Notifications
You must be signed in to change notification settings - Fork 133
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
Clarify the relation between supercompact
and compact
for printing
#3543
Comments
It would be great to discuss this with @simonbrandhorst who made the original plan for the revised printing -- Simon, let us know when you have time (or perhaps you can make it to one of the regular Wednesday online meetings / coding sprints) |
" Apparently it is used when printing multidimensional arrays but not when printing |
We discussed this at length during the Wednesday coding sprint. Overall we found it very confusing that If they are ultimately really meant to be independent, we think it should be renamed. Moreover, this relation should still be documented explicitly. But before we do any that, we feel we need to carefully study and revise how this (and the rest of the printing system) works anyway. We felt that there are already a bunch of things that could and should be tweaked in the system. E.g. In particular we looked at existing code using Overall we were then wondering whether it really makes sense to keep In the meantime, we formulated the following action plan for the immediate future: For now we will experiment with essentially We add a few helper methods to AA: # convenient way to request supercompact printing; easier to remember,
# and also protects against typos.
# moreover, for the time being this enables supercompact and compact together;
# once everything uses the new helpers we can then easily experiment
# with either merging supercompact and compact; or again separating them
supercompact(io::IO) = IOContext(io, :compact => true, :supercompact => true)
# helper to test if supercompact mode is on (easier to remember, type stable,
# and also protects against typos
is_supercompact(io::IO) = get(io, :supercompact, false)::Bool
# helper to test if compact mode is on (easier to remember, type stable,
# and also protects against typos
# For now, also enforces implication
is_compact(io::IO) = get(io, :compact, false)::Bool || is_supercompact(io)
Then a typical function show(io::IO, R::SomeRing)
@show_name(io, R)
@show_special(io, R)
if is_compact(io)
# no nested printing
...
else
# nested printing allowed, preferably supercompact
...
end
end After doing this "everywhere", compact and supercompact would be effectively equivalent. If we end up deciding we want to merge them it'll be easy enough to implement using some search & replace. If we determine we want to keep them separate we can get rid of the implication in one or both of Assuming @simonbrandhorst and @thofma are also OK with this experiment, we would gradually go through AA, Nemo, Hecke, Oscar to update that the existing |
I don't quite follow all the reasons why something must change. But let me mention some things so that we are all on the same page.
or
The first example is the current state of the art, since As far as I can see, we are mainly irritated by the word Rename Edit: In case it is not clear, I don't see the value of the experiment, since I don't understand why something must change except for the name. |
First off, I'd be happy to do something else, that addresses the various issues that float around printing. IMHO But something must change.. As you say: a lot of our printing code still predates the new concept and as such is not honoring supercompact at all, but is instead honoring compact ; and other code setting compact when it maybe really should be setting supercompact -- but thanks to the lack of explantory comments, the intent of the code is often unclear. In particular some code already sets compact in one places and checks for compact in another, which "fit together". If we change compact to supercompact in one but not in the other, stuff starts breaking. If we don't change anything, then supercompact doesn't work. So we can then either...
Here is a random example from Hecke.jl that handles compact but not compact (and also is missing oneline vs. detailed handling).
For the sake of not talking past each other, perhaps you can suggest how you'd envision how we'd handle this specific example, @thofma ? BTW, I think the The other issue (which is not in the title of this one, but that we discussed) is the inconsistent use of |
Of course Nemocas/AbstractAlgebra.jl#1627 from the issue description is also relevant; I'd appreciate comments on it, too, @simonbrandhorst @thofma |
The origin of all the
From this point of view, all the
I would prefer the last option. There are already some changes lined up for breaking the printing in AA, so we would not need to worry about compability.
This is one of the many examples, which we did not handle before Oscar 1.0 because of time constraints. After implementing the "new printing" for the
(I am ignoring indentation and some other details)
Agreed. I think figuring out if and when we should honor a |
Just to record this here explicitly: I am happy with the plan as outlined with @thofma |
This should be resolved as we essentially renamed |
Right now these two coexist and it is not quite clear how they are supposed to interact.
This leads to changes like Nemocas/AbstractAlgebra.jl#1627 which just uses both. Should we do this globally? Or should perhaps
supercompact
implycompact
(the former is "our" setting, the latter is Julia's)? Or something elseCC @simonbrandhorst @thofma @fieker
The text was updated successfully, but these errors were encountered: