|
|||||
Groups | |||||
Related Syntax |
By default, all OmniMark rules are active all the time. You can change this by bundling your rules into groups:
group mary find "lamb" ... find "school" ... group tom find "piper" ... find "pig" ... group #implied process-start using group mary do submit "Mary had a little lamb" done using group tom do submit "Tom, Tom, the piper's son" done
In this program, only rules in the group "mary" are used to process "Mary had a little lamb". Only rules in the group "tom" are used to process "Tom, Tom, the piper's son".
Why the group #implied
before the process-start rule? The process-start rule is a rule like any other, so it is affected by groups like any other rule. group #implied
stands for the default group. (In a program with no groups, all rules are in the default group.) Only the default group is active when a program starts. All other groups are inactive. So, you have to have at least one rule in the default group in order to activate any of the other groups. If we didn't place the process-start rule into the default group, no rules would ever be active in this program.
Any rule that occurs before the first group statement in your program automatically belongs to the default group, but, if you use groups, it is usually a good idea to place your global rules explicitly into group #implied. (Consider what would happen if you included a file that contained group statements at the top of your main program file and didn't explicitly assign your global rules to group #implied.)
All rules in the default group are global. You cannot disable the default group, so rules in the default group are always active. For this reason, you may want to keep the number of rules in the default group to a minimum (but remember, you must have at least one).
Can you have more than one group active at a time? Certainly:
using group mary and tom and dick and harry
You can also add a group to the current set of active groups using "#group" to represent all active groups:
using group mary and tom and #group
Related Syntax group next group is using group |
---- |