Progress
Programming
Handbook
Feature Summary
Progress procedure overriding allows the following:
- The programmer can write different versions of an internal procedure, all with the same name, inserting each into a different procedure file. The same applies to user-defined functions.
- The programmer can make a procedure file a super procedure of the local procedure file or of the current Progress session by using the ADD–SUPER–PROCEDURE method (and can reverse this action by using the REMOVE–SUPER–PROCEDURE method). When the local procedure file invokes an internal procedure or user-defined function, Progress searches for it using well-defined search rules.
Table 3–3: Search Rules Step Location 1 Local procedure (the procedure with the original RUN statement) 2 Super procedures of the local procedure file 3 Current Progress session 4 External proceduresFor more information on the search rules, see the ADD–SUPER–PROCEDURE( ) Method reference entry in the Progress Language Reference .
NOTE: When a super procedure executes a RUN SUPER statement, you can specify that Progress continue to search the super procedure chain of the local procedure instead of the super procedure chain of the current super procedure. This behavior is controlled by an optional parameter of the ADD–SUPER PROCEDURE method. For more information, see the Progress Language Reference .- An internal procedure can invoke the super version of itself by using the RUN SUPER statement. A user-defined function can do the same by using the SUPER function.
NOTE: An internal procedure or user-defined function can exclude itself from the INTERNAL–ENTRIES attribute’s list by defining itself using the PRIVATE option. For more information on the PRIVATE option, see the PROCEDURE Statement and FUNCTION Statement reference entries in the Progress Language Reference .- The programmer can get a list of the super procedure handles associated with a procedure file or with the current Progress session by using the SUPER–PROCEDURES attribute. For each procedure handle, the program can use the INTERNAL–ENTRIES attribute to determine the internal procedures and user-defined functions the corresponding procedure file contains. For each internal procedure and user-defined function, the program can determine the signature by using the GET–SIGNATURE method.
- The super version of an internal procedure (or user-defined function) can get a handle to the procedure file of the original version by using the TARGET–PROCEDURE system handle. Similarly, the super version can get a handle to the procedure file of the original invocation (RUN statement or user-defined function invocation) by using the SOURCE–PROCEDURE system handle. TARGET–PROCEDURE and SOURCE–PROCEDURE thus allow access to the attributes and objects associated with the original procedure files.
- The programmer can write prototypes for internal procedures and user-defined functions invoked in the local procedure file and implemented in super procedures. When a prototype appears, the Progress compiler stores its information so that the INTERNAL–ENTRIES attribute and GET–SIGNATURE method can access it.
For more information on super procedure prototyping, see the "Super Procedure Prototyping" subsection of this section.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |