Rule Flags describe rule behavior; they control how the rule is built, how it operates, and how it can be altered.
Rule DataTypes are not flags; they are declarations about what the rule is expected to produce.
Flags are pre-defined; it is not possible to create custom flags, and they are not usually typed into source by hand.
The following table summarizes all flags currently defined. These are in alphabetical order.
Flag Name |
Usage frequency |
Description |
Async |
rare |
Indicates that the rule returns a Promise. Usually used for web references.
|
Cached |
common |
The value produced by the rule is stored, such that the next time it is referenced, the cached value will be returned. It is extremely uncommon to create rules which are not cached, and may negatively impact performance.
|
Design |
uncommon |
The value is stored once per Design. This behaves like a “static” variable in programming languages. Should only be used when there is only one value per Design, no matter how many instances are produced. Something like a Design version would be suitable for this.
|
External |
Rare |
Indicates that the content represented by the rule is a handle to an external resource. When external rules are unbound, an “unbind event” is generated which can be used to notify the external system that it is no longer in use.
|
Jscode |
Rare |
Indicates that the body of the rule should not be pre-processed in the normal way.
|
Locked |
Uncommon |
Indicates that the rule cannot be overridden. This is used by BaseLibrary Designs to ensure that accidental overrides of essential rules don’t happen.
|
Lookup |
Common |
The rule will check the parent for a rule of the same name, and use it before using the local default expression. Supplied parameter expressions always take precedence over lookups.
|
Method |
Common |
The rule is a function-like object, which can take arguments. Methods do not cache their return values.
|
Optional |
Never |
This flag is reserved for future use.
|
Parameter |
Common |
Indicates that the rule body may be overridden by an expression supplied by the parent.
|
Parent |
Uncommon |
Indicates that the rule body should be evaluated in the context of the parent. Because parameter expressions are evaluated in the parent context, this can allow the same source to be used in the body of the rule.
|
Required |
Common |
Indicates that the rule (which must be a Parameter) must be defined by a supplied expression; no default expression is allowed.
|
Spec |
Internal use only |
This flag is used only in the BaseLibrary.
|
Temporary |
Uncommon |
This flag is only respected in Model rules. It indicates that the rule should NOT be stored in the model beyond the current session.
|
Update |
Rare |
Indicates that this rule must be evaluated during an update cycle. Even though this sounds like a good thing, do not use it unless it is absolutely necessary.
|
Not all flags can be used together, and not all flags can be used on all rule types.
The following flags effectively lock rules from being overridden:
External, Design, Locked, Method, Update.
The following flags are available to rule authors creating rules:
Cached, Parameter, External, Lookup, Design, Parent, Required, Jscode, Async, Locked, Update, Temporary.
The following flags are the only flags that can be combined with Child Rules:
Locked, Temporary.
The following flags are the only flags that can be combined with Methods:
Jscode, Async, Locked.