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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b99897135d6631cc X-Google-Attributes: gid103376,public Path: g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: memory management and productivity Date: Mon, 21 Jun 2004 18:47:45 +0200 Organization: AdaCL Message-ID: <1374354.xRstPWWbXB@linux1.krischik.com> References: <40d15023$1_1@baen1673807.greenlnk.net> <2jnh22F12nvieU2@uni-berlin.de> <1848444.QBUeL21EQ8@linux1.krischik.com> <1087831367.30099@master.nyc.kbcfp.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1087882223 07 11139 einbXJC6t14GSMA5 040622 05:30:23 X-Complaints-To: usenet-abuse@t-online.de X-ID: SXxqHEZZ8eTsz8JLo6MZS2TZ65Sju-ZmJ8Beq52QurOG3lB332bm4A User-Agent: KNode/0.7.7 Xref: g2news1.google.com comp.lang.ada:1760 Date: 2004-06-21T18:47:45+02:00 List-Id: Hyman Rosen wrote: > Martin Krischik wrote: >> For example C++ std::vector<> can't store polymorvic objects - Ada soon >> to come Ada.Containers.Indefinite_Vectors can. > > That seems like a neat trick, given that a vector is > intended to work like an array, > that is, to have a > contiguous block of equal-sized objects. It only has to work like it - internally it might be implemented differently i.E. using dynamic memory. > How is the > container going to work? The trick is that Ada can "clone ()" objects without: class Base { virtual Base* clone(); } That's because Ada knows (by hidden size attribute) how large any object is. Including polymorvic objects. Write any indefinite object to a Stream via 'Output and look at it with hex editor. In that respect Ada is even cooler then Java: You can serialise any object without a Serialiseable interface. So, the truth is that the object is copied into dynamic memory. However, you will never know about it. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com