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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,436e4ce138981b82 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-10 06:58:20 PST Path: archiver1.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!zeus.visi.com!news-out.visi.com!green.octanews.net!news-out.octanews.net!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!cyclone.bc.net!sjc70.webusenet.com!news.usenetserver.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 10 Mar 2004 08:58:19 -0600 Date: Wed, 10 Mar 2004 09:58:18 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: abstract sub programs overriding References: <1078776213.376775@master.nyc.kbcfp.com> <1078839257.157439@master.nyc.kbcfp.com> <5cmr40t76va200betf07b7bd6er05ltto9@4ax.com> <1078845298.702789@master.nyc.kbcfp.com> <0ipr40thtf86b520a0qdi003aj87gtuhd4@4ax.com> <1078849973.701176@master.nyc.kbcfp.com> <1078924150.268074@master.nyc.kbcfp.com> In-Reply-To: <1078924150.268074@master.nyc.kbcfp.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.77.160 X-Trace: sv3-IX2E0hxIpXq2gb7M2al1DhU6cvj++0wj36EcC1tW6Udbyt+siTJZjm1j5n5F6KTHwtrv6sI4eHm+966!YgZ1KtYLlC6g0VjmmtI9i53lv2zNyWiJKTc3Q3or3eXtaGNPNwRojZl5y7Cfcg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.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: archiver1.google.com comp.lang.ada:6211 Date: 2004-03-10T09:58:18-05:00 List-Id: Hyman Rosen wrote: > In C++ you can also choose whether to dispatch or not, but the default > is to dispatch. If you want to call a function of a particular class, > you just specify that (eg., Mumble::Foo()) and you get it. Remember, > Ada compilers still use a vtable pointer inside each object, not the > way you would have it, a two-part object/vtable fat pointer. No, Ada semantics is that each object of a tagged type contains (surprise!) a tag. It is common for this tag to be a pointer to the dispatch table. There are provisions for converting the tag to a particular value for saving in files, or for distributed systems. (see RM E.2.3) > Really? What if you have a hierarchical class where each base has its > own Initialize? Is each version responsible for calling the version of > its base? What is to keep a base version from converting to classwide > type and calling a dispatching method which will try to use an unset > member of the derived class (eg., a file not yet opened)? The semantics of the language, of course. You can, if you want create an Initialize procedure that reads an uninitialized component, but that is no different from any other procedure, and most compilers will warn you about it. The usual is, as Dmitry pointed out, to provide default values for such components so that the problem never arises. To answer your specific question, whether the file associated with an object is opened as a side effect of an initial value, or by Initialize procedure is up to the programmer. But assuming that the type has an object of type File_Type from Ada.Text_IO, Ada.Sequential_IO, or Ada.Direct_IO, if the file is not opened before reading from it, Use_Error will be raised. This means that the compiler chosen representation for File_Type must either be an access type, or a record type with at least one subcomponent with a default value. -- Robert I. Eachus "The only thing necessary for the triumph of evil is for good men to do nothing." --Edmund Burke