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,a046ce7f5ee1fa51 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-04 07:29:00 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: new_line in a put_line Date: 04 Dec 2002 10:25:47 -0500 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) Message-ID: References: <1ec946d1.0212020657.2bd8b5c@posting.google.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1039016227 28394 128.183.235.92 (4 Dec 2002 15:37:07 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 4 Dec 2002 15:37:07 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:31422 Date: 2002-12-04T15:37:07+00:00 List-Id: Dmitry A. Kazakov writes: > On 04 Dec 2002 10:31:15 +0100, Fraser Wilson > wrote: > > >Dmitry A. Kazakov writes: > > > >> Just do not do I/O from them. Define a mutex as a protected object and > >> a spin lock as a controlled type (less troubles with releasing a > >> mutex): > > > >[..] > > > >> procedure Put_Line (Text : String) is > >> Get_It : Lock (Write_Mutex'Access); > >> begin > >> Ada.Text_IO.Put_Line (Text); > >> end Put_Line; > > > >Something inside me rebels at using side-effects from a declaration > >like that. > > Right, right. It is also my opinion [there was a thread regarding this > subject in c.l.a] that using unused (:-)) objects probably indicates a > design problem. That's what pragma Unreferenced (in GNAT) is for; it documents that the object is declared only for the hidden effects of Initialize and Finalize. Assuming Lock is a controlled type, that releases the lock in Finalize, this is an excellent design. -- -- Stephe