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,daca227a72518885 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-09 11:23:29 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newshub.sdsu.edu!small1.nntp.aus1.giganews.com!border3.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.clear.net.nz!news.clear.net.nz.POSTED!not-for-mail NNTP-Posting-Date: Thu, 09 Oct 2003 13:23:28 -0500 From: Craig Carey Newsgroups: comp.lang.ada Subject: Re: Unbounded Strings Date: Fri, 10 Oct 2003 07:23:33 +1300 Message-ID: References: <20031007175516.DC2884C40C8@lovelace.ada-france.org> <_XYgb.3237$dn6.2766@newsread4.news.pas.earthlink.net> 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-209.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: 10 Oct 2003 07:23:34 +1300, drone5-svc-skyt.qsi.net.nz NNTP-Posting-Host: 203.97.37.6 X-Trace: sv3-i2XpQAFrqPuZDYpMnrChlpj3mDwtqV0/FnUmqX1XnHQJtpjCb+tQ4LLF3oZiCQ3DnvBGsk0hM6yiTwI!kNL9rtyzknLqnL55TTTJnhQFJG4SZO3gAzJGJbt1yE10yBh2H0cFW+vW+5reWGqox7GFzouj3c78!G3QRSAc= 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:552 Date: 2003-10-10T07:23:33+13:00 List-Id: On Wed, 08 Oct 2003 18:46:18 GMT, Jeffrey Carter wrote: >Andrew Carroll wrote: >> I did some experimenting, thanks to Cohen's book and persistance I found Is that book online? ... >All elementary types are passed by copy, regardless of the parameter mode. >All tagged and limited types are passed by reference, regardless of the >parameter mode. For all other types, the compiler chooses the parameter >mode best suited to the type. Other candidates for the by-reference type include: * records with an aliased field * records with a field that is a type that is either Volatile or Atomic. Once tagged is used, then a type can't be renamed without having to rename all of its procedures which is adverse to my idea of a language that ought provide strong type checking. No procedures beneath/above this line. Use of the limited reserved word can stop the assigning of records which can be too inconvenient. This is what I do: use aliased fields, and if it results in a few extra procedures, maybe they get inlined correctly: --------- type UST is Ada.Strings.Unbounded.Unbounded_String; type UST_Rec is tagged record Val : aliased UST; end record; type UST_Ptr is access constant UST; function Access_To (X : UST_Rec) return UST_Ptr; --------- By some method, the function returns a pointer to the field. So the parameter is aliased and the term by-reference is not getting properly explained when there is no consideration of what it means when there is background garbage collecting. Craig Carey