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, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c63aa81a67eceb8f X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Ragged Array Proposal Date: 1999/09/25 Message-ID: <7sijl6$ta0$1@nnrp1.deja.com>#1/1 X-Deja-AN: 529392918 References: <37e7c08e@eeyore.callnetuk.com> <37EA9A72.594ED8F5@mitre.org> <37ebb120@eeyore.callnetuk.com> X-Http-Proxy: 1.0 x40.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sat Sep 25 13:45:12 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-09-25T00:00:00+00:00 List-Id: In article <37ebb120@eeyore.callnetuk.com>, "Nick Roberts" wrote: > Fruits: constant array (Positive range <>) of Unbounded_String := > (To_Unbounded_String("Apple"), > To_Unbounded_String("Orange"), > To_Unbounded_String("Pear"), > ...); > > This technique suffers from the same heavy syntax of the allocator > technique, Well as I noted in an earlier message, the "light" syntax of C hides a lot of sins, it is always puzzling to people who are using C at first, that they cannot declare the Fruits array as in our example, and then say if (Fruits [j] == "abc") ... of course they *can* say it, it is perfectly legal and well defined in C, it just does not do what the programmer expects (generally the result will be false). If you really get so upset by reading To_Unbounded_String, then replace it with a unary "+" as in my previous example (I actually wanted the unary "+" in the standard here, but that proposal did not attract enough support). Indeed both Jean Ichbiah and I have always liked the idea of using unary plus as a quietish, but still explicit, conversion operator, and we both pushed for adding one extra unary operator (obvious choice the pillow or currency conversion symbol) which would have no predefined meaning, but would be specifically intended as a conversion operator of this kind, but that again did not attract enough support. > and while it saves having to explicitly declare an access > type, it's almost certain to have an implementation that > involves dynamic allocation (together with the further baggage > of a controlled type). Sure, but you would be surprised what a large percentage of string processing stuff is quite happy with such overhead (think of SPITBOL, and even Java). > A very clever optimiser might be able to perform > pre-allocation (as mentioned in > other posts in this thread), but I suspect that most Ada compilers, in > reality, would not. Waste of time I would think ... Robert Dewar Sent via Deja.com http://www.deja.com/ Before you buy.