19.4 Feature sets
The University of Melbourne Mercury implementation supports a number
of optional compilation model features,
such as Trailing or Tabled evaluation.
Feature sets allow the programmer to assert that a module requires
the presence of one or more optional features in the compilation model.
These assertions can be made use a ‘pragma require_feature_set’
declaration.
The ‘require_feature_set’ pragma declaration has the following form:
:- pragma require_feature_set(Features).
where ‘Features’ is a (possibly empty) list of features.
The supported features are:
- ‘concurrency’
- This specifies that the compilation model must
support concurrent execution of multiple threads.
- ‘single_prec_float’
- This specifies that the compilation model must use
single precision floats.
This feature cannot be specified together with the ‘double_prec_float’
feature.
- ‘double_prec_float’,
- This feature specifies that the compilation model must use double precision
floats.
This feature cannot be specified together with the ‘single_prec_float’
feature.
- ‘memo’
- This feature specifies that the compilation model must support memoisation
(see Tabled evaluation).
- ‘parallel_conj’
- This feature specifies that the compilation model must support
parallel execution of conjunctions.
This feature cannot be specified together with the ‘trailing’
feature.
- ‘trailing’
- This feature specifies that the compilation model must support
trailing, see Trailing.
This feature cannot be specified together with the ‘parallel_conj’
feature.
- ‘strict_sequential’
- This feature specifies that a semantics that is equivalent to the strict
sequential operational semantics must be used.
- ‘conservative_gc’
- This feature specifies that a module requires conservative garbage
collection.
This feature is only checked when using the C backends
It is ignored by the non-C backends.
When a module containing a ‘pragma require_feature_set’ declaration
is compiled, the implementation checks to see that the specified features
are supported by the compilation model.
It emits an error if they are not.
A ‘pragma require_feature_set’ may only occur in the implementation
section of a module.
A ‘pragma require_feature_set’ affects only the module in which
it occurs; in particular it does not affect any sub-modules
If a module contains multiple ‘pragma require_feature_set’ declarations
then the implementation should emit an error if any of them specifies a
feature that is not supported by the compilation model.