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,ce0900b60ca3f616 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-02 15:12:22 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newspeer.radix.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: List container strawman X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BE3235D.E292B890@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9rti6v$hcu$1@news.huji.ac.il> <1EyE7.10050$xS6.13527@www.newsranger.com> <9rue9f$j4t$1@nh.pace.co.uk> <9ruiet$kqg$1@nh.pace.co.uk> Mime-Version: 1.0 Date: Fri, 2 Nov 2001 22:51:09 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:15709 Date: 2001-11-02T22:51:09+00:00 List-Id: Marin David Condic wrote: > > If the List type is simply private, can it contain an element that is > Controlled? In other words, is this a problem that can be covered up with > just one more layer of indirection? There's no problem with the actual type being Controlled if the formal type is [limited] private. If there's anything about the actual type that requires finalization we would hope the client would implement it as a controlled type, since objects of this type are going to come and go as items are added and removed from the structure. > > I'm guessing that Ada.Strings.Unbounded has to do *something* fairly dynamic > in its underlying implementation and it has to solve the problem of > assignment along the way. That either means a) the problem can be solved > from within the language or b) its done with smoke and mirrors behind the > scenes. I'm guessing that A is likely to be the case, so perhaps a solution > does exist? Unbounded_String may be implemented as a controlled type. It's implementation is not defined, so compiler writers may use any tricks they think necessary, but you could write the implementation in plain Ada. Another place where some compiler writers use tricks is the interaction between a random number Generator value and the Random function. The generator holds the state data for the algorithm, which are supposed to be updated when a number is generated. You can implement Generator as a controlled type with a pointer to the state data, but again other tricks are possible from within the compiler. -- Jeffrey Carter