ocamlbuild icon indicating copy to clipboard operation
ocamlbuild copied to clipboard

MPR#6098: Global predicates

Open damiendoligez opened this issue 9 years ago • 2 comments

PR transferred from https://caml.inria.fr/mantis/view.php?id=6098 [original reporter: @danmey ]

In ocamlbuild we use _tags to associate predicate with list of tags. Sometimes it's useful to associate globally set tags, usually it's done in such way:

true: debug
<src/*>: package(foo)

here debug is universally global tag associated with any path in the source tree

Nothing stops us however say this:

debug
<src/*>: package(foo)

this has the following advantage: it syntactically restrict the tag to work only in global scope. It might be useful for example when mirroring the commandline options as tags:

copts(-O3)
lopts(foo.cma)
I(ocamlbuild)

If the tags where defined using predicate, it might be more difficult to support it in a sane way.

damiendoligez avatar Mar 01 '17 15:03 damiendoligez

Triage: this makes _tags ambiguous, and I don't see what improvement it brings anyway.

whitequark avatar Mar 01 '17 22:03 whitequark

I have considered the need for a precidate/condition to put on the left of the column : that would have a non-boolean semantics: default: foo or global: foo. Currently some parts of ocamlbuild rely on true: ... in this way, and having a way to express the intent would be nicer. For example, having such a thing would let us consider having plugin-tags specified within _tags, instead of as a command-line flag (it would be more convenient for users; the idea is that we could parse the _tags file at plugin-build time and only care for a specific predicate, plugin: or something).

I never managed to get convinced enough by the idea to actually implement it. It is a sort of pragmatic compromise, where we accept to take some distance from the ideal/clean semantics of the _tags file, but in an arguably principled/elegant way. Unsure.

gasche avatar Mar 03 '17 15:03 gasche