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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fa18fb47ddd229a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-11 09:39:40 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!bigfeed2.bellsouth.net!news.bellsouth.net!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!stamper.news.pas.earthlink.net!newsread1.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: Jeffrey Carter Organization: jrcarter commercial-at acm [period | full stop] org User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Proposed change to BC iterator parameters References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 11 Dec 2003 17:39:40 GMT NNTP-Posting-Host: 63.184.8.229 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.news.pas.earthlink.net 1071164380 63.184.8.229 (Thu, 11 Dec 2003 09:39:40 PST) NNTP-Posting-Date: Thu, 11 Dec 2003 09:39:40 PST Xref: archiver1.google.com comp.lang.ada:3391 Date: 2003-12-11T17:39:40+00:00 List-Id: Robert A Duff wrote: > The data we're talking about is not *very* global. It's local to the > procedure containing the instantiation. Yes, it's global to the actual > procedure passed to Apply, but that's probably a pretty small region of > code. In simple languages such as FORTRAN 66, data are either local or global. In Ada, there are a number of shadings to the locality of data. This kind of data is essentially "state data", and should be considered an acceptable use. It is similar to the components of a protected unit: global to, but accessible only by a small, well defined set of operations. I agree with Duff in general, but in the case of providing iteration over a protected structure, one must use an access-to-subprogram parameter. The actual subprogram will often need to be defined at the library level to pass accessibility checks. To allow various iterators to access local data, you have to use the Context parameter approach. If the protected structure is implemented with an unprotected structure component, and the protected iterator is implemented by instantiating an iterator from the unprotected structure, then the unprotected iterator has to have a Context parameter as well. Protected structures, especially protected queues, are quite useful. It is because the PragmAda Reusable Components provide protected structures that they have Context parameters for their iterators, not because of a concern about global data. Since AI-302-01 is based on the PragmARCs, its iterators also have Context parameters. -- Jeff Carter "Sir Lancelot saves Sir Gallahad from almost certain temptation." Monty Python & the Holy Grail 69