Skip to content

Manual: unify compilers/toplevel options at source level#491

Merged
gasche merged 5 commits intoocaml:trunkfrom
Octachron:manual_unified_compiler_options
Nov 5, 2016
Merged

Manual: unify compilers/toplevel options at source level#491
gasche merged 5 commits intoocaml:trunkfrom
Octachron:manual_unified_compiler_options

Conversation

@Octachron
Copy link
Copy Markdown
Member

This pull request proposes to unify the description of the options of the bytecode compilers,
native compilers and toplevel at the source level.

Currently, these descriptions are kept separated in their respective manual section with a significant overlap between these sections. This duplication increases the risk of desynchronisation between the different options and impedes the propagation of typographic error corrections.

With this PR, all these options section are merged together in manual\manual\cmds\unified-options.etex. The difference of options between compilers and toplevel are then handled using conditional tex macros. The compilers and toplevel sections then set the right boolean parameters and include the unified-options.etex file. This means that are the descriptions are still duplicated in the generated manual.

I have tried to keep the readability cost of this unification as low as possible, however it is clear that this cost is non-zero.

@damiendoligez damiendoligez added this to the 4.04-or-later milestone Mar 3, 2016
@mshinwell mshinwell removed this from the 4.04 milestone Sep 7, 2016
\notop{%
\item["-a"]
Build a library(\qcma\nat{ and ".a"/".lib"} file\nat{s})
with the object files (\qcmo\nat{ and ".o"/".obj" files} files)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"files" is repeated here

\nat{For} instance,
"-ccopt -L"\var{dir} causes the C linker to search for C libraries in
directory \var{dir}. \comp{(See the "-custom" option.)}
}%notop
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that readability could be improved here by duplicating the "for instance" sentence instead of trying to share at such a fine granularity.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that duplicating the introductory clause should work fine, but I am probably biased against duplication.

compiled interface files (".cmi"), compiled object code files
(\qcmo), \nat{and }libraries (\qcma)
\comp{, and C libraries specified with "-cclib -lxxx"}.}%notop
\top{source and compiled files.}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, readability could be improved by duplicating the first sentence into three complete versions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like before, I will try first to just duplicate the adverbial for clause.

\notop{%
\item["-output-obj"]
Cause the linker to produce a C object file instead of \comp{a bytecode}
\nat{an} executable file. This is useful to wrap OCaml code as a C library,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\comp{a bytecode file}\nat{an executable file}. Having self-contained fragments in the conditionals helps readability.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point.

Print all external commands before they are executed,
\nat{in particular invocations of the assembler, C compiler, and linker.}
\comp{in particular invocations of the C compiler and linker
in "-custom" mode. Useful to debug C library problems.}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't the last sentence be present in both outputs?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.

@gasche
Copy link
Copy Markdown
Member

gasche commented Nov 2, 2016

(I had not noticed this PR previously, apologies.) I think that it is a good idea, and that the readability cost can be made fairly small (see comments inline; I think we can make the source "read" better by introducing some reduplication where full factoring gives something too fine-grained). I would wait after the release that Damien is currently working on, and then merge it in trunk unless someone objects.

This commit creates a file unified-options.etex which regroups at
source level the description of the compilers and toplevel options.
Difference of options between native/bytecode compilers and toplevel
are handled via conditional tex macros.
@Octachron Octachron force-pushed the manual_unified_compiler_options branch from bf54e6d to 101a009 Compare November 5, 2016 15:44
@Octachron
Copy link
Copy Markdown
Member Author

Thanks @gasche for the suggestion. You are right duplicating isolated fragments have improved the readability. I have rebased this PR to integrate your suggestion and new options (except the ones not yet merged in trunk (e.g. ocamlparam option)).

I have also added a short description in the manual readme to (potentially) help people find the right file to edit in order to add new options. Another point, sometimes the toplevel referred to the option description in comp.etex: these references has been replaced by the full description for the sake of uniformity.

@gasche gasche merged commit 826780c into ocaml:trunk Nov 5, 2016
@gasche
Copy link
Copy Markdown
Member

gasche commented Nov 5, 2016

I see no reason not to merge, so I merged. Thanks for the nice work!

camlspotter pushed a commit to camlspotter/ocaml that referenced this pull request Oct 17, 2017
…ptions

Manual: unify compilers/toplevel options at source level
mshinwell pushed a commit to mshinwell/ocaml that referenced this pull request Jun 29, 2021
stedolan added a commit to stedolan/ocaml that referenced this pull request Mar 22, 2022
stedolan added a commit to stedolan/ocaml that referenced this pull request May 24, 2022
stedolan added a commit to stedolan/ocaml that referenced this pull request May 24, 2022
86526aa flambda-backend: Middle-end support for local allocs (ocaml#491)
969b937 flambda-backend: Backend support for local allocations (ocaml#478)
2d1e6ef flambda-backend: Remove leading space from LINE. (ocaml#484)

git-subtree-dir: ocaml
git-subtree-split: 86526aa
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
Co-authored-by: mirzababarbaigbukhari <mirzababar@thesmallsquare.com>
Co-authored-by: Thibaut Mattio <thibaut.mattio@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants