Please enable JavaScript to view this site.

A-Shell Reference

Navigation: A-Shell BASIC (ASB) > User-Defined Functions

Private Functions and Procedures

Scroll Prev Top Next More

Added October 2016

Function and Procedure definitions within ++INCLUDE modules may 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.)

History

2016 August, A-Shell 6.3.1523, compiler edit 770:  Add private attribute for functions and procedures.