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,5117b1b6391a0e06 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 24 Jun 2004 15:53:10 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1087410710.477506@master.nyc.kbcfp.com> <1087474761.60413@master.nyc.kbcfp.com> <7o83d0hf6sqgng2980e1tg7iu864m5m50u@4ax.com> <1in5d05aa4rfqlt7e76gk87ucd3vuru6pm@4ax.com> <1087564576.388973@master.nyc.kbcfp.com> <1087575262.304708@master.nyc.kbcfp.com> <2i5dd0lu0i3a8bokfh7916r4j67g42ri4o@4ax.com> Subject: Re: A simple ADA puzzle (I haven't the answer) Date: Thu, 24 Jun 2004 15:53:33 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-z8saPD1Jy/5uHbTgijqRkBDAad8iPxX6VlRe8MQRD3kmFmJvM1fOH4q0EXutRzJbmz4s2CX7bKJggWH!MELrWf0NUYy1qHK1SkdnAkV+IWsZrhi8xyeSAvjlDHFjudblLxNiNAJmEgGRjagDWugL0ST41dtd X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1864 Date: 2004-06-24T15:53:33-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:pltjvkdjp69c.11hhxh2y8idq9.dlg@40tude.net... > On Wed, 23 Jun 2004 16:37:01 -0500, Randy Brukardt wrote: > > > "Dmitry A. Kazakov" wrote in message > > news:2i5dd0lu0i3a8bokfh7916r4j67g42ri4o@4ax.com... > > ... > >>>As I have said, it's extremely simple. Automatic variables are invisible. > >> > >> Huh, how is it better than Ada's limitation on tagged types? > > > > The only limitation on tagged types in Ada 2005 is that you can't extend a > > formal type in a generic body. See AI-344, approved in Palma de Mallorca. > > (There are accessibility checks if you try pass an object of a nested type > > outwards.) > > But I will be still able to allocate it, return a class-wide pointer and > then to dispatch to an out-of-scope subroutine. It seems that some > additional overhead will be needed to catch that. No. The conversion to the class-wide pointer (presumably global) would fail its accessibility check. So the program would be illegal. No overhead needed. Tucker's idea was simply to move the accessibility checks from the declaration of the type (the Ada 95 rule) to the uses of the objects (which turn out to be only a handful of places). It is true that dispatching to an overridden routine for a type in a nested scope will be more expensive (there will be a wrapper to set the static link or display properly). But that's a small price to pay for something that you can't do at all now. (And it won't make any existing code slower, obviously.) > BTW, there could be alternatives to accessibility checks, when overhead is > accepted. For example, one could forcibly upcast objects if their type goes > out of scope. Silent truncation (upcasting) of a type was considered a very bad thing during the design of Ada 95. Anything that would require that (such has having both statically and dynamically tagged operands in a single call - see 3.9.2(8)) is illegal. You could argue whether that is a good idea or not, but I don't think that we're going to change that part of the philosophy. Randy.