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,b5ab7c96b188b59e X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-12 14:26:06 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!news-out.visi.com!petbe.visi.com!newspeer.monmouth.com!newsfeed.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: The "()" operator revisited. Date: 12 Jan 2004 17:26:05 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: pip1-5.std.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1073946365 27894 192.74.137.185 (12 Jan 2004 22:26:05 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 12 Jan 2004 22:26:05 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:4358 Date: 2004-01-12T17:26:05-05:00 List-Id: "Frank J. Lhota" writes: > Last June, I proposed that in order to provide an abstract array capability, > Ada 0y should support user-defined "()" and "():="operators. Since this > issue has come up again, I would like to summarize and expand on this > proposal. This is a good idea. As you note below, it's got a long way to go before you've got a list of wording changes to the RM. For example, the notion of operator-named *procedures* does not currently exist in Ada. But before bothering with that, I think there are some important issues to work out: You seem to be saying that components of arrays (or just abstract arrays?) are always passed by copy. That seems like a real problem, since for efficiency, most compilers pass large things by reference. (I'm talking about the case of array-of-large-array or array-of-large-record.) Furthermore, if the component type is limited, it is *required* to be passed by reference. This raises the question: can "():=" be declared for limited types? What does A(I)'Access mean in this scheme? Are there interactions with Adjust, which is normally called for assignment of nonlimited controlled types? You seem to treat 'out' parameters as copy-out only. But for composite types, 'out' means pretty much the same thing as 'in out' -- at least *some* parts of the object are copied *in* (see RM for details). Likewise, if the component type is an access type, you can't allow undefined values to be created -- all access objects have to be initialized to 'null' if they aren't initialized to something else meaningful. You seemed to be hoping that this new notation could underly the definition of the *existing* array indexing semantics. That would be elegant. However, some of the above issues mean it doesn't work -- at least as you've defined it so far. > Note: the following discussion probably has an insufficient amount of > legalese to satisfy language lawyers. Once we've thrashed out these ideas, > I'll be happy to work with anyone with formalizing this proposal. I hate to be discouraging, but my guess is that a proposal like this is *not* going to be accepted by the ARG, even if were written up as proper RM wording changes. > Similar declarations can be added to Ada.Strings.Bounded. This would permit > the higher-level Ada string types to use the same notation as the low-level > standard String type. Well, it allows that for the particular notation of array indexing, and that would be a good thing. But it doesn't completely solve the problem. It doesn't support slice notation (but I don't think slices are all that important). And it doesn't support string literal notation -- I think that *is* important -- it's really annoying that you can't have a string literal of type uunbounded string. Similarly, it doesn't support aggregate notation. If I were designing a language from scratch, I would allow user-defined meanings for all of the above notations. But as I said, unfortunately, I don't see this happening for Ada 0X. - Bob