Private Attribute for Functions and Procedures

Language/compiler (edit 770) enhancement: Private attribute for functions and procedures. Function and Procedure definitions within ++include modules may now be preceded with the keyword PRIVATE to make them invisible outside of that ++include file. This is analogous to the use of the PRIVATE keyword to declare a variable as being visible only within the ++include file. For example:

PRIVATE FUNCTION FN'TEST() AS F6

   ....

ENDFUNCTION

 

The two most likely motivations for declaring a function or procedure to be private are:

•   As a namespace mechanism to prevent conflicts with procedures of the same name in other include files. Previously, the only way to avoid this risk would have been to append or prepend some module-specific text (perhaps the module name) to the routine name, but this ends up making your routine names overly long, making them difficult to type and read.

•   As a way of making the code easier to understand or debug later. (Eliminating the possibility that the routine is called from anywhere outside the current module eliminates the need to consider impossible scenarios that would otherwise be difficult to rule out without searching every possible file that could use this module.)