From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 25 Sep 92 21:16:34 GMT From: sampson@cod.nosc.mil (Charles H. Sampson) Subject: Re: Using Global Variables Message-ID: <1992Sep25.211634.18564@nosc.mil> List-Id: In article <16869CC93.M19481@mwvm.mitre.org> M19481@mwvm.mitre.org writes: > [re Doug Smith's example of an integer variable (Is_This_A_Global_Variable) > encapsulated in a package body with entry procedures Get and Put for reading > and writing.] >Yes, I'd call Is_This_A_Global_Variable global, because it can be used by >anyone for any purpose. The only way to know how it's being used and whether >one procedure may be clobbering the value entered by another procedure would >be to look at every instance of Get and Put in the system and to understand >the relationships between the procedures that they appear in. A point of encapsulation, I think its main point, is to hide the repre- sentations of data from their users. A very complex data structure encapsu- lated in a package might have many procedures and functions implemented to access it. After all, data that no one can read or write is not very useful. Just because these accesses have been supplied and somebody might introduce a bug by misusing one of them doesn't make the data global. Charlie