File: ordered-set-language.rst

package info (click to toggle)
ocaml-dune 3.20.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 33,564 kB
  • sloc: ml: 175,178; asm: 28,570; ansic: 5,251; sh: 1,096; lisp: 625; makefile: 148; python: 125; cpp: 48; javascript: 10
file content (36 lines) | stat: -rw-r--r-- 1,491 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Ordered Set Language
====================

A few fields take an ordered set as argument and can be specified using a small
DSL.

Dune interprets this DSL into an ordered set of strings using the
following rules:

- ``:standard`` denotes the standard value of the field when it's absent
- an atom not starting with a ``:`` is a singleton containing only this atom
- a list of sets is the concatenation of its inner sets
- ``(<sets1> \ <sets2>)`` is the set composed of elements of ``<sets1>`` that do
  not appear in ``<sets2>``

In addition, some fields support the inclusion of an external file using the
syntax ``(:include <filename>)``. For instance, this is useful when you need to
run a script to figure out some compilation flags. ``<filename>`` is expected to
contain a single S-expression and cannot contain ``(:include ...)`` forms.

Note that inside an ordered set, a list's first element cannot be
an atom except if it starts with ``-`` or ``:``. The reason for this is
that we're planning to add simple programmatic features in the
future so that one may write:

.. code::

   (flags (if (>= %{ocaml_version} 4.08) ...))

This restriction will allow you to add this feature without introducing
breaking changes. If you want to write a list where the first element
doesn't start with ``-``, you can simply quote it: ``("x" y z)``.

Most fields using the ordered set language also support
:doc:`../concepts/variables`. Variables are expanded after the set language is
interpreted.