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,147f221051e5a63d X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!news1.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!198.186.194.250.MISMATCH!news-out.readnews.com!news-xxxfer.readnews.com!panix!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: memory management in Ada: tedious without GC? Date: Sat, 24 May 2008 16:52:03 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <4ddef8bf-b5b1-4d7e-b75b-386cd6c8402c@l17g2000pri.googlegroups.com> <9f2c2db4-d6c1-4cdf-884c-5cbc26ac7701@d1g2000hsg.googlegroups.com> <1qxcw3pphdlek.1jgsfwb7atdmo.dlg@40tude.net> <10j4zhb9ge8ea.156spz1dkc4vb$.dlg@40tude.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1211662324 24047 192.74.137.71 (24 May 2008 20:52:04 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sat, 24 May 2008 20:52:04 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:TKyqMLrYzJ22hxmLsp9qdJao4LI= Xref: g2news1.google.com comp.lang.ada:334 Date: 2008-05-24T16:52:03-04:00 List-Id: "Dmitry A. Kazakov" writes: > Yes, this why it is safe to assume that the program may not rely on it. Such assumptions are never safe, because programmers make mistakes. > Yes, this is the same dilemma as with re-ordering operands in expressions. I don't like the permission to reorder operands, either. But at least for that, there's a legitimate efficiency concern. For finalization, I seriously doubt that the permission to reorder has any significant efficiency benefit. > I understand your argument, but I think that the solution is wrong. I'd > prefer a better control over the side effects in order to make such > (erroneous) programs illegal. It is especially important for modern > pipelined, multi-core architectures. Why not to perform initialization of > components concurrently? Sure, if the compiler can prove there are no side effects, it can reorder, intersperse, and/or do things in parallel. In that case, "in declaration order" and "in implementation-defined order" are equivalent rules. But this is a much bigger change to Ada. >> Consider two finalization actions -- one flushes a buffer to disk, >> and the other closes the file handle. > > It is a wrong design to handle this from components and from different > actions of finalization. Buffer cannot be flushed without knowing the file > handle. Thus with right design the buffer component will have no access to > the file handle. Hence flushing could only be put into the finalization of > the composite object, which would automatically enforce proper order. I admit my example is weak. >>>... Consider a statically constrained discriminant as an >>> example. If the compiler could remove it, we would have the problem of >>> measurement units solved! >> >> Yes. I've always wanted to do that optimization. >> >> The strange thing is that most compilers do exactly that for array >> bounds, but not for discriminants. Array bounds are really >> discriminants, deep down! ;-) > > Yes, and don't forget type tags. They are discriminants too! Right. - Bob