Ticket #6 (closed enhancement: wontfix)
Add support for conditional compilation of predicates
| Reported by: | victor | Owned by: | pmoura |
|---|---|---|---|
| Priority: | minor | Milestone: | Logtalk enhancements |
| Component: | compiler | Version: | 2.31.4 |
| Keywords: | Cc: |
Description
Hi,
There is an example to explain the idea since it is difficult to express it with words :
Let imagine a special predicate named conditional_compilation/2. The first argumentation would be a tagname and the second would be predicates.
For example we can write :
my_pred(X) :-
conditional_compilation(debug, (write('Debug message'))),
conditional_compilation(info, (write('Info message'))),
another_pred(X).
There would be a compilation flag, for example named, conditionnal_tag/1, that would tell to the compiler which tagged conditional_compilation predicate should be enabled. For example if we compile the example with conditionnal_tag(debug) as a compilation flag, the previous example would be equivalent to this :
my_pred(X) :-
write('Debug message'),
another_pred(X).
If debug AND info are enabled it will look like :
my_pred(X) :-
write('Debug message'),
write('Info message'),
another_pred(X).
These example are for debugging message, but I am sure there is a lot of another uses.
