Predicates

UpCommands
Sitemap
 

Predicates are used to allow the conditional execution of Actions. They form the passive, watching part of rules, the trigger. All defined predicates are made available as methods of the object a rule script is executed for. As they take precedence any original method with the same name as a predicate will be shadowed.

The interpreter cannot enforce this, but predicates have to be functions, i.e. they have to return a value. Another important point to consider when writing one is that they are trusted by the system and not restricted to the safe environment created for the rule scripts and the actions. Because of this it is not possible to define new predicates from within a rule script, this would pose a serious security risk.

The body of predicates has access to the input object too, in the form of the variable input containing the name of its command. The variable effectively operates like the this/self reference in other object oriented languages.

Predicates
Subcmd Description
::fmail::predicate
name arguments body

Defines a new command, just like proc and its cousin ::fmail::action. The command has access to the input object and the full resources of the trusted environment. It is made available as method of the input object itself and thus introduced into rule scripts.


© Andreas Kupries
Last update at Thu Nov 11 21:48:40 MET 1999