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,a9026b81108642ee X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!atl-c08.usenetserver.com!news.usenetserver.com!pc02.usenetserver.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Address of an object References: <382nx7mt637x$.6hjqgb4zxzss.dlg@40tude.net> <1158363114.393740.59040@h48g2000cwc.googlegroups.com> <1i3ne95psolai.abl9eureg5t9$.dlg@40tude.net> From: Stephen Leake Date: Tue, 19 Sep 2006 05:15:01 -0400 Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (windows-nt) Cancel-Lock: sha1:43oOjRGa82p7VpdeR6tUioipSpA= MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 48d5c450fb516759e00d421947 Xref: g2news2.google.com comp.lang.ada:6652 Date: 2006-09-19T05:15:01-04:00 List-Id: "Dmitry A. Kazakov" writes: >> So you want access to some compiler-dependent information; clearly the >> method will be compiler-dependent, since it isn't defined by the language. > > No, I don't want to access it. I only want my information. I don't understand. You want write-only data? >> What are you going to do with the "dopes" you add? They won't be >> visible from Ada. > > That's exactly the goal, because what I want is to extend types in a way > Ada does not support. I wanted to add something to a type without > quarreling with Ada, which mistakenly [OK, that was a political decision] > does not support MI. It was corrected in Ada 2005 but only for pure > interfaces, while I need implementations. There is a vast number of cases > where it might be useful. So you are trying to extend the Ada language. You should be editing the compiler; that's one of the reasons GNAT is open source. > It seemed quite easy, thank to user-defined pools. Well, actually it is > spoiled a bit with pointers and generics, but that's another story. Actually, that's part of the reason MI isn't in Ada. You must consider how it impacts the entire language. > The idea is as follows: > > 1. You define a pool which eventually takes its memory from some another > pool. > > 2. When something is allocated in the pool, you just add necessary data to > the allocated object in front of the allocated memory block > > 3. The interface to this is a generic package, which provides a pointer > type to the objects in the pool. [Unfortunately, the type of the pointer's > pool cannot be made opaque, but that is a minor language problem.] So this generic package needs to read the data, from Ada. Or at least provide a pointer to it, so other Ada packages can read it. > 4. New operations are defined on the pointer type. In Ada, or some other language? > It is clean and portable design, because all the functionality is hidden > behind the pointer type. It does not break the type allocated in the pool > in any way. > > The only unexpected problem with this is that the compiler mangles pointers > and there seems to be no way to influence or learn how it does this. Read the source code for the compiler. Or ask the compiler vendor. -- -- Stephe