From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cef1968b544ddf26 X-Google-Attributes: gid103376,public From: nasser@apldbio.com Subject: Re: Static variables? Date: 1997/03/18 Message-ID: <5go0s7$2un@lana.zippo.com>#1/1 X-Deja-AN: 226674054 Sender: usenet@drn.zippo.com References: <332D71FF.4773@cae.ca> Organization: Perkin-ELmer Newsgroups: comp.lang.ada Date: 1997-03-18T00:00:00+00:00 List-Id: as Dr Dewar mentioned, package variables retain their values from the time the package becomes avaliable to the time the package life ends (usually the end of the program , but not always the case, example, if the package is declared inside a block or procedure), may be a picture will help: package A interface +---------------------+ | i: integer; -----------> retain its value also client <=======> | procedure foo; | | ....... | +---------------------+ ............................................. package A body +---------------------+ |j: integer; --------------> these variables retain | | their values | procedure foo is | | n: integer; ------------> variables here are auto | begin | variables, new copies are | .... | created each time foo is called | end foo; | | | | begin | | .... ----------------> this code execute once when | end A; | package is first elaborated. | | use this code to init package +---------------------+ variables. you can think of variables declared in the package interface as static puplic in C++ class terminolgy, and variables declared in the body of the package but outside the functions and procedure of the package body as static private in C++. offcourse it is a good idea to try to avoid using variables in the interface part of the package. nasser