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-Thread: 103376,591cbead201d7f34 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!n77g2000hse.googlegroups.com!not-for-mail From: gpriv@axonx.com Newsgroups: comp.lang.ada Subject: Re: Prohibiting dynamic allocation for the given type Date: Wed, 19 Mar 2008 06:13:16 -0700 (PDT) Organization: http://groups.google.com Message-ID: <25c21bee-f075-4538-8473-ecbd8c20a19c@n77g2000hse.googlegroups.com> References: <83335709-e099-416b-9967-5ab6aa0aea11@i12g2000prf.googlegroups.com> <89ac4348-4c21-478e-b491-97bfbebfdb86@p73g2000hsd.googlegroups.com> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205932397 14248 127.0.0.1 (19 Mar 2008 13:13:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 19 Mar 2008 13:13:17 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: n77g2000hse.googlegroups.com; posting-host=151.196.71.114; posting-account=YaY8rAoAAAAAnFXOECY3BGVJsrvFJCgy User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20485 Date: 2008-03-19T06:13:16-07:00 List-Id: On Mar 19, 4:24 am, Maciej Sobczak wrote: > On 19 Mar, 04:06, gp...@axonx.com wrote: > > > Ada is high level language > > That does not matter. > Ada is a high level language, but still provides two ways to create an > object: > > X : Type; > Y : Type_Ptr := new Type; > > If these two methods are available, then apparently there is a > difference between them and this difference is not in *where* objects > are created, but *how long* they are allowed to live. > > The high-level part of Ada can hide the "where" part, but not "how > long". > > For some types I might want to prohibit one of these two ways of > object creation. > > Prohibiting the first one is easy with limited types that have unknown > discriminants + factory functions that return pointers. > > Prohibiting the second one seems to be impossible. > For me this is a limitation. > > > What's wrong with good old comments atop of type declaration. > > What's wrong with C with good comments? :-) Nothing.. > > > But if you insist you may do run-time check by > > defining custom Storage_Pool pool for your object > > Storage_Pool is a property of the pointer, not the type. Are you asking for solutions or simply trolling? > > -- > Maciej Sobczak *www.msobczak.com*www.inspirel.com