Progress
Programming
Handbook
Internal Procedures and Encapsulation
The IN handle option allows you to execute an internal procedure that is defined in any external procedure context. The handle can be any field, variable, parameter, system handle, or attribute expression that returns a valid procedure handle. This capability promotes code re-use and encapsulation. Encapsulation is a technique of modular design where you hide (encapsulate) related data and functionality from other external procedures and provide all access to the hidden data through internal procedures defined by the hidden context. It also allows you to break up a larger external procedure into several smaller ones, especially if you encounter r-code segment limits (see "R-code Features and Functions"). For more information on procedure handles, see the "External Procedures" section.
Valid Procedure Handles
To be valid, the procedure handle must identify one of the following external procedures that also defines the internal procedure you want to execute:
In short, the procedure handle must identify the context of a procedure that is still in scope when you execute the internal procedure. For more information on procedure context, procedure scope, and the procedure call stack, see the "External Procedures" section.
NOTE: You can use the VALID–HANDLE function and the TYPE procedure handle attribute to test whether a procedure handle identifies an active procedure context. VALID–HANDLE returns TRUE if the specified procedure context is in scope. The TYPE attribute must also return “PROCEDURE” to filter out valid widget handles.For information on persistent procedures and how to obtain procedure handles for them, see the "Persistent and Non-persistent Procedures" section. Otherwise, your procedure handle must be set to the THIS–PROCEDURE system handle within the external procedure that contains the internal procedure you want to execute.
Condition Handling
Internal procedures executed with the IN handle option raise ERROR on the RUN statement for the following conditions:
You can trap these ERROR conditions using the NO–ERROR option of the RUN statement.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |