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,13b19740d69cbdc2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-14 11:48:05 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!snoopy.risq.qc.ca!chi1.webusenet.com!news.webusenet.com!newsfeed-east.nntpserver.com!nntpserver.com!border1.nntp.ash.giganews.com!firehose2!nntp4!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Tue, 14 Oct 2003 13:48:03 -0500 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: Modes (was unbounded_string) Date: Wed, 15 Oct 2003 07:47:59 +1300 Message-ID: References: <20031010074015.761204C40C1@lovelace.ada-france.org> X-Newsreader: Forte Agent 1.92/32.572 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: Customer of Mercury Telecommunications Ltd Cache-Post-Path: drone5.qsi.net.nz!unknown@tnt1-213.quicksilver.net.nz X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) X-Original-NNTP-Posting-Host: drone5-svc-skyt.qsi.net.nz X-Original-Trace: 15 Oct 2003 07:48:12 +1300, drone5-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-Z8Nr5szY63pVHAvDOofvFgb4MVV8ryQUxXUSZe0wqUGTNiwAVmiWwuDO3568YNtAxexVlym+GJLzj1J!t0gegpQfPGRGmxQGoYZFCXNfnYQdjKEnJqbshNAiNu5GrvCYz8PweYbpbSGV+oMQt/jOdNtjrfeE!aXT+vwc= X-Complaints-To: Complaints to abuse@clear.net.nz X-DMCA-Complaints-To: Complaints to abuse@clear.net.nz 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.1 Xref: archiver1.google.com comp.lang.ada:848 Date: 2003-10-15T07:47:59+13:00 List-Id: On 10 Oct 2003 11:18:28 -0400, Stephen Leake wrote: >"Andrew Carroll" wrote: ... >Tagged types and full limited types are always passed by reference, >because it almost always matters for them. ... Not really true. It could be if AARM/RM 12.4(8) was deleted: 12.4 Formal Objects (8.) The type of a generic formal object of mode in shall be nonlimited. (8.a) Reason: Since a generic formal object is like a constant of mode in initialized to the value of the actual, a limited type would not make sense, since initializing a constant is not allowed for a limited type. That is, generic formal objects of mode in are passed by copy, and limited types are not supposed to be copied. http://www.adaic.org/standards/95aarm/html/AA-12-4.html Excerpt from AI-00318 ("Returning [limited] objects without copying"): | From: Randy Brukardt | Sent: Thursday, February 7, 2002, 3:05 PM | | Here is an example that came up in Claw where we really wanted | constants of a limited type: | | [...] its the original problem all over again), so we had to turn that | into a variable and initialize it component-by-component in the package | body's elaboration code: | | Standard_Classes_Root : Key_Type; | | function Classes_Root return Key_Type is | begin | return Standard_Classes_Root; | end Classes_Root; | | begin | Standard_Classes_Root.Handle := 16#80000000#; -- Magic number | Standard_Classes_Root.Predefined_Key => True; | ... | | Which is essentially how it is today. | | This turned into such a mess that we gave up deriving from it altogether, ... | | I certainly hope that newcomers to Ada don't run into a problem like this, | because it is a classic "stupid language" problem. | | Simply having a way to initialize a limited constant with an aggregate | would be sufficient to fix this problem. "Constructor functions" might | add orthogonality, but seem unnecessary to solve the problem of being | able to have constants as part of an abstraction's specification. | To bypass the restriction of 12.4(8), an "access constant" [read-only] pointer to the "aliased" unchanging variable would be passed in: generic type Number is limited private; -- "limited" stops assigning Zero : in Num; -- Illegal. -- Here is a workaround: type Num_Const_Ptr is access constant Num; Zero : Num_Const_Ptr; ... package Here is some text from AI-00287 (topic "Limited Aggregates Allowed"): | How do you capture the result of a function call? You put it in a | constant: "X: constant T := F(...);". But if it's limited, you have to | *rename* it: "X: T renames F(...);". Again, that's not something that | would naturally occur to a beginner -- and the beginner would rightly | look upon it as a "trick" or a "workaround". >You can't specify the parameter passing mechanism, except by making >the type tagged or fully limited. What about putting "aliased" keyword into the record's definition(?). ---- Corrupted elections in USA: http://news.independent.co.uk/world/americas/story.jsp?story=452972 "some of the code downright suspect - for example, an overtly meaningless instruction to divide the number of write-in votes by 1. ... "Most suspect of all was the governor's race in Alabama, where the incumbent Democrat, Don Siegelman, was initially declared the winner. Sometime after midnight, when polling station observers and most staff had gone home, the probate judge responsible for elections in rural Baldwin County suddenly "discovered" that Mr Siegelman had been awarded 7,000 votes too many. ... the change was enough to hand victory to his Republican challenger, ... the state's Republican attorney general refused to authorise a recount or any independent ballot inspection." The San Mateo county assessor (Slocum) has some information on the need for correct and verificable results from USA elections: http://www.warrenslocum.com/