Apama 10.15.0 | Developing Apama Applications | EPL Reference | Lexical Elements | Names
 
Names
Names are used in EPL programs to refer to the various different kinds of entities in the program. Actions, variables and reference variable members, parameters, monitors, methods, aggregate functions, events, packages, and plug-ins all have names.
Description
Names are either simple or qualified. Simple names consist of a single identifier. Qualified names consist of a sequence of identifiers separated by . symbols, with an optional . prefix.
Every name has a scope, which is the part of a program's text where the name can be used as a simple identifier. The scope is determined by where in the program the name is declared. See Variable scope.
Do not create EPL structures in the com.apama namespace. This namespace is reserved for future Apama features. If you inadvertently create an EPL structure in the com.apama namespace, the correlator might not flag it as an error in this release, but it might flag it as an error in a future release.
Name Precedence
When there are duplicate unqualified names for types, the correlator searches for the associated definition in the following order, and uses the first one it finds:
1. The monitor-internal type definitions, for example, event type definitions and custom aggregate function definitions.
2. Definitions that have been brought in with a using declaration in the current file.
3. Definitions in the current package (this could be the root namespace if a package was omitted).
4. The root namespace.
The fully qualified name of a type can always be named by using a dot (.) followed by the fully qualified name. For example, select .com.apama.aggregates.avg(x) uses the built-in avg type, even if com is a name in the current package.
If you try to create a package-level type that has the same name as a definition brought in with a using declaration, it causes a compiler error and the code does not inject. For example:
package foo;
using bar.Bar;
event Bar { // Causes an error when injecting as Bar has already been
           // defined by a "using" declaration.}
You cannot define a type that has the same fully-qualified name as another type.
If two types have the same name but are in different packages, either one can take precedence over the other depending on their ordering in the precedence list. The correlator uses the first match it finds even if that results in an error when a lower-priority match would have worked. For example:
X x;
This causes an error if, for example, there is an aggregate function called X in the current package even if there is an event type called X in the root namespace. You can use a . prefix on the name to force it to be looked up from the root namespace, in which case the fully qualified name must be used.