Use session super procedures
- Last Updated: August 7, 2023
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
SESSION handle:
|
- The procedure file the routine is run in (that is, either the procedure that
actually contains the
RUNstatement or function reference or, if you use theRUN INsyntax or theDYNAMIC-FUNCTION . . . INsyntax, the procedure handle following theINkeyword). - Super procedures added to that procedure handle, starting with the last one added.
- Super procedures added to the
SESSIONhandle, starting with the last one added.
In addition, in the case of a RUN statement, if an internal procedure of
that name is not located anywhere, the final step of the search is for a compiled
external procedure (.r file) of that name.
You should exercise caution when adding super procedures to the session, precisely
because their contents become available to absolutely every procedure run in the
session. Nevertheless, this technique can be effective in some cases, especially for
extending the behavior of existing application procedures without having to edit them to
put in ADD-SUPER-PROCEDURE() methods. If the existing procedure was
originally intended to run a compiled external procedure (.r file)
and does not explicitly include the .p or .r
extension on the filename reference in the RUN statement, then the
external .r file can be replaced by a session super procedure that
contains an internal procedure of the same name. This changes the behavior of the
application without making any changes whatsoever to the existing application files (not
even recompiling them).
Super procedures might seem like a complicated mechanism, but consider that they are intended to allow you to provide standard behavior for many procedure objects. This means that you can carefully craft the super procedure code for a type of behavior, and then every other procedure that uses that super procedure inherits the behavior automatically and transparently. This is the power of super procedures.