Forum Post: USING statements and their order

  • Thread starter Thread starter mstassen
  • Start date Start date
Status
Not open for further replies.
M

mstassen

Guest
What will happen in the next situation There is a Zclass.cls in package X and in package Y (Zclass in Y inherits form Zclass in X) In my code i have USING X.*. USING Y.*. MyClass = NEW ZClass(). Which class wil be Myclass? The one from package X or package Y ? And why ? Is the order of USING important ? I have read the documentation about this but i cannot get it: During procedure or class definition file compilation, ABL resolves all unqualified type name references according to the following algorithm: a) ABL examines the USING statements in order and, for each statement that specifies a object-type-name, compares the unqualified name with the last node of the object-type-name. If the names are equal, ABL considers this a match and continues compilation with the current USING statement according to its specified FROM option: If FROM ASSEMBLY is specified, ABL searches for object-type-name in the loaded assemblies. If FROM PROPATH is specified, ABL checks if object-type-name specifies a built-in class or interface type, and if not, ABL searches for a corresponding class file according to the object-type-name package relative to PROPATH. If no FROM option is specified, ABL checks if object-type-name specifies built-in class or interface type, and if not, ABL first searches for a corresponding class file according to the object-type-name package relative to PROPATH, then searches for object-type-name in the loaded assemblies. b) If ABL has not matched the unqualified type name with a object-type-name specified in a USING statement, ABL again examines the USING statements in order. For each USING statement that contains a package-name.* or namespace.*, ABL replaces the “*” with the unqualified name, creating a object-type-name. ABL then continues compilation with the current USING statement according to its FROM option: If FROM ASSEMBLY is specified, ABL searches for object-type-name in the loaded assemblies. If FROM PROPATH is specified, ABL checks if object-type-name specifies a built-in class or interface type, and if not, ABL searches for a corresponding class file according to the object-type-name package relative to PROPATH. If no FROM option is specified, ABL checks if object-type-name specifies built-in class or interface type, and if not, ABL first searches for a corresponding class file according to the object-type-name package relative to PROPATH, then searches for object-type-name in the loaded assemblies. c) If ABL does not identify a qualified type name from any object-type-name derived from a USING statement, it searches for the unqualified type name reference as a complete ABL type name (defined without a package-name). Thus, ABL searches for an ABL class file with a filename equal to the unqualified type name directly on PROPATH. If none of these searches identify a valid type definition, ABL generates a compiler error that the type cannot be found.

Continue reading...
 
Status
Not open for further replies.
Back
Top