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 Path: g2news1.google.com!news2.google.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local02.nntp.dca.giganews.com!nntp.sun.com!news.sun.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 02 Oct 2008 07:33:33 -0500 Newsgroups: comp.lang.ada Subject: Re: Naming convention to identify functions with side effects References: <5654ee5f-aa9f-4fff-87e0-45854b850f26@y38g2000hsy.googlegroups.com> <29ac62e1-78da-4048-ad95-8f88a29f7d31@z6g2000pre.googlegroups.com> <48e13f14$0$6610$9b4e6d93@newsspool3.arcor-online.net> From: Ole-Hjalmar Kristensen Organization: Sun Microsystems Date: 02 Oct 2008 14:33:32 +0200 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cache-Post-Path: news1nwk!unknown@khepri42.norway.sun.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-neCdtw3YJ7cz630mC8TEnENgBCMxIM8O5lIlq9pgQVdP0Ld0gwsBVFNmNktOVrsAfKPVm+OOP+up8Jo!MslaW2tIYNse2eCYH77nKlKA3GY6oj3wGggt1J6qpPnYM0L/qIqm1Ttl X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.39 Xref: g2news1.google.com comp.lang.ada:2192 Date: 2008-10-02T14:33:32+02:00 List-Id: How would you implement the lock in youre case? I prefer not to mess around with semaphores, but use protected objects instead. In that case keeping the lock across the two calls is not so trivial. >>>>> "GB" == Georg Bauhaus writes: GB> Some issues become more obvious in a concurrent setting GB> perhaps, GB> Web_Page.Load ("http://www.irvine.com"); GB> if Web_Page.Is_Loaded then... GB> There needs to be a lock of some sort joining the two calls. GB> Otherwise, the Web_Page object might have changed GB> between the two calls, a logic error. GB> Again, it might be tempting to pack the two calls in just GB> one in order to hide the locking mechanism, to give the GB> illusion of atomicity. But shouldn't normal Ada GB> concurrency features be employed instead? GB> If concurrency features of Ada are used instead, the GB> naming problem is also gone: GB> the commands (procedures) can be verbs and the queries GB> (predicate functions) can be named "Is_Something" or GB> "Has_Something". -- C++: The power, elegance and simplicity of a hand grenade.