Skip to content
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

Global predicates #6098

Closed
vicuna opened this issue Jul 28, 2013 · 4 comments
Closed

Global predicates #6098

vicuna opened this issue Jul 28, 2013 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Jul 28, 2013

Original bug ID: 6098
Reporter: meyer
Status: resolved (set by @damiendoligez on 2017-03-01T15:35:32Z)
Resolution: suspended
Priority: normal
Severity: feature
Version: 4.01.1+dev
Category: -for ocamlbuild use https://github.com/ocaml/ocamlbuild/issues

Bug description

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
: package(foo)

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

Nothing stops us however say this:

debug
: 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.

@vicuna
Copy link
Author

vicuna commented Jul 28, 2013

Comment author: @dbuenzli

I don't understand.

@vicuna
Copy link
Author

vicuna commented Jul 28, 2013

Comment author: meyer

OK. Let me explain.

Normally you define your tags using predicates like this:

 and <**/test*>: debug

debug tag will be defined for every source file in src/ directory having an extension of ml or and prefixed with test.

Sometimes however we don't want to associate a predicate with the tag, but instead just want to define a global tag that always holds when it's possible:

O3

for the first tag O3 the C compiler will receive an option -O3.
It's fine to say also:

: O3

It would also allow to use the tags for ocamlbuild itself:

ocamlopt(arm-gnueabi-linux-ocamlopt)
copts(-O3)

In the later case, it's not possible to associate any predicate, as ocamlbuild is invoked once for the source tree.

@vicuna
Copy link
Author

vicuna commented Jul 28, 2013

Comment author: meyer

Acutally hold on, it's still possible to do it for ocamlbuild, because the command line options might have the same name, and we specify targets in ocamlbuild, therefore

ocamlbuild bar/foo.cma
ocamlbuild baz/main.native

and for this _tags:

: copts(O3)
: ocamlopt(arm-gnueabi-linux-ocamlopt)

So we would have an isomorphism between tags and command line options, possibly dropping completely command line options and replacing with tags.

@vicuna
Copy link
Author

vicuna commented Mar 1, 2017

Comment author: @damiendoligez

ocamlbuild is now a separate project that lives on GitHub.
PR transferred to ocaml/ocamlbuild#192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant