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,b553d2c02a2df59f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!207.69.154.102.MISMATCH!elnk-atl-nf2!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread3.news.atl.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: Matthew Heaney@MHEANEYIBMT43 Newsgroups: comp.lang.ada Subject: Re: limited types (Was: Records that could be arrays) References: From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 25 Feb 2006 15:05:02 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.atl.earthlink.net 1140879902 24.149.57.125 (Sat, 25 Feb 2006 07:05:02 PST) NNTP-Posting-Date: Sat, 25 Feb 2006 07:05:02 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:3159 Date: 2006-02-25T15:05:02+00:00 List-Id: "Dmitry A. Kazakov" writes: > I think that there should also be [limited] containers of limited types. > For this we need a construction model, which would allow user-defined > in-place constructors. After all Ada has always had arrays of limited > components. We have to extend this model onto user-defined containers. But you can pass in an Initialize procedure as a parameter of an insertion operation, to perform whatever initialization needs to be done. Also (see below for ex), you already have copy ctors for Ada 2005, even for limited types. > I think that this would require separation of assignment from copy > constructor, as C++ does. Though the default must be that assignment is > generated from destructor and copy constructor. You could pass in a copy constructor if this were an unbounded form (I thik), something like: procedure Insert (C : in out CT; E : in ET; Copy : not null access function (E : ET) return ET) is Node : Node_Access := new Node_Type'(Element => Copy (E), others => <>); begin ... end; Wouldn't that work? I don't have a compiler that can do that yet, but I know this would be legal: procedure Op (E : ET) is EE : ET := Copy (E); begin ... end; so I assume initialization of an aggregate is the same. (But I could be wrong.)