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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,87557ce53b069315 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: meaning of "current instance" Date: 1999/11/11 Message-ID: <382b4885_4@news1.prserv.net>#1/1 X-Deja-AN: 547517374 Content-transfer-encoding: 7bit References: <382b0da1_2@news1.prserv.net> Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: abuse@prserv.net X-Trace: 11 Nov 1999 22:51:49 GMT, 129.37.62.135 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 1999-11-11T00:00:00+00:00 List-Id: In article , tmoran@bix.com wrote: > In >> type T is >> tagged record >> I : Integer := Init (T'Access); > what does Init(T'Access) mean? The locution "T'Access" inside the declaration of type T means the "current instance" of the type, similar to "self" in other languages. This syntax seems to throw everyone off, I guess because you're using the name of a type (instead of an object) as the target of 'Access. No, it is not an error. "'Access" means "current instance" of the type. What I'm trying to do here is let a descendent define what the default value of a component is, for a component declared in the ancestor. Function Init takes an access parameter designating T'Class. It is implemented by calling a primitive operation that dispatches according to the tag of the "current instance," which can be any type in the class. -- If we let the Creationists have their way, we may as well go whole hog. Let us reintroduce the flat-earth theory, the chemistry of the four elements, and mediaeval astrology. For these outworn doctrines have just as much claim to rival current scientific views as Creationism does to challenge evolutionary biology. Abusing Science: The Case Against Creationism Philip Kitcher