Adding a new field to record formatter_out_functions to redefine the meaning of indentation#595
Adding a new field to record formatter_out_functions to redefine the meaning of indentation#595pierreweis wants to merge 2 commits intoocaml:trunkfrom
formatter_out_functions to redefine the meaning of indentation#595Conversation
|
I think @seliopou 's original documentation is easier to understand. Also, the paragraph you added should probably be in the interface, not the implementation. I think I like the other change, it looks useful, but I can't really review since it's in the middle of unrelated changes about |
|
I know it is not that important, but could you refrain from putting back a load of unnecessary (I have not other thoughts on the patch for or against). |
|
Thank you for your feed back: in fact I see that I did too much pull on my I will split the modifications as you suggest.
|
|
I was with @pierreweis when we looked into this patch. @Drup We will propose a split a version in a day or two if it is ok with you. Would you suggest another PR where each commit is clearly delimited or two PRs ? I guess the latter does not make much sense ... @lpw25 Someone else seems not to have refrained from removing or not putting |
|
@rbonichon one PR, and you don't have to make another one, just force push on this one. |
The unified style is not using |
|
My understanding is that, at least until recently, there were two styles: with or without ;; |
|
@Drup Got it! @lpw25 Could you point me to where this "unified" style is defined ? I have up until now seen no such thing in the standard library (just look at almost any module). If such a style for the compiler does not exist, it might however be a good idea to have one one day to rely on to avoid the kind of discussion we are having 😄 . |
I suppose there are two separate changes really. One is removing
Well it doesn't really exist, but the
Strongly agree. (Although I only really care about the standard library for this -- because some people use it as a guideline when they are learning the language, so it can have a large influence on coding style in the wide community). My point is mostly that such changes should not be smuggled into other PRs, otherwise we end up having these discussions on a PR which should be discussing an entirely unrelated feature/bugfix. |
|
If you guys can write a style guide that we all agree on, we'll use it for the compiler. Good luck on getting consensus, though. In the meantime please avoid wasting your time in edit wars. For the standard library, I accepted @lpw25's argument even though it's borderline (I don't think there's anything really wrong with teaching several styles). Finally, I wholeheartedly agree with this:
|
|
@rbonichon After six months, this pull request still seems to have the main change (as per the title of this GPR) mixed up with a lot of documentation changes, some of which seem entirely unrelated. Is it possible to split those out? I think there may also be an outstanding review comment (in @Drup 's comment) about @seliopou 's documentation which I'm not sure has been addressed or refuted. |
|
I don't think anything as changed, and if so, it's hidden in a 700 line diff of unrelated changes. If people want review, they should make their commits easy to review. Please use |
|
@mshinwell Yes this can be split. We will try to get back to it asap.
|
d613155 to
2970f7a
Compare
|
@pierreweis and I have now split the commit into 2 separate groups as well as we could. |
|
I think the addition is reasonable and useful. However, this is a hard breaking change for everyone using The only way I can see to make this work reasonably is to avoid modifying the existing interface and to introduce instead a new function of type: val set_formatting_functions:
?out_string : (string -> int -> int -> unit) ->
?out_flush : (unit -> unit) ->
?out_newline : (unit -> unit) ->
?out_spaces : (int -> unit) ->
?out_indent : (int -> unit) ->
unit -> unitand 5 getters. This would be reasonably future proof to extend. |
|
@Drup Yes the same problem was raise in #615 (which builds on this PR) by @alainfrisch. He offers the same solution which I think is reasonable. However, only 1 package ( |
|
@rbonichon and next time someone wants to add a new field, are we going to break compat again ? Might as well bite the bullet and make it future proof now. |
|
@Drup There are two sides to this argument. On the one hand you are right (as @alainfrisch) to point out the problem of retro-compatibility. On the other hand, this record has not changed in maybe 15 years and Let me repeat that your solution has its appeal and I would be fine either way. I would also accept whatever @damiendoligez thinks is best. |
|
OK, let's break |
- Typos - English - Extended documentation for semantic tags
Before this commit, indentation was identical to outputting blanks. This is generally true but not always: in some applications you may want to use '\t' as indentation but not for blanks, ... The `formatter_out_functions` record is extended with an extra settable field `out_indent`. This allows the user to control this aspect of pretty-printing. The teststuite has been update to reflect this modification.
|
Yes, they were merged as part of #615. Good catch, though, for the missing Changes entry. |
Implement caml_alloc_dependent_memory and caml_free_dependent_memory
Co-authored-by: Christine Rose <christinerose@users.noreply.github.com> Co-authored-by: Anil Madhavapeddy <anil@recoil.org>
All output of the pretty-printer were abstracted in record
formatter_out_functionsexcept for indentation which was linked to output spaces. Indentation could be more complex than simply adding spaces at begining of lines.The expected impact to existing software should be minimal.
Documentation has been update and carefully checked.