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,3d6ef988ec3a5ef7 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: renaming Interfaces.Java.Ada_To_Java_String to the + operator Date: 1998/01/11 Message-ID: #1/1 X-Deja-AN: 314947717 References: <01bd1e34$1632c2c0$24326489@Westley-PC.calspan.com> <871zyej2sg.fsf@ix.netcom.com> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 884531305 20864 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-01-11T00:00:00+00:00 List-Id: Chris said <> The other way of handling variable length lists is to use an aggregate subprogname ((arg1, arg2, arg3, arg4, ....)); that is definitely neater than &. Furthermore, if you use the & approach you have to be very careful not to introduce quadratic processing (which is often quite tricky to do, if the target is really an array (*)) If you need heterogenous typing, then you define an appropriate union type, and convert to it: subprogname ((+arg1, +arg2, +arg3, +arg4, ....)) which still retains linear processing time. If Chris' example is anywhere near realistic (where many operands were joined with &), then I think the use of & was probably not such a good choice as using aggregates. (*) the problem of aggregated operators, concatenation on strings is a canonical example, is an interesting one. No language in common use tries to address the issue of converting A & B & C & D ... into what is wanted, which is Concat ((A,B,C,D ...)) I can certainly imagine a pragma that would have this effect: pragma Collect_Operation (Operation => name, Subprogram => name); where the parameters designate the dyadic operator to be treated, which needs to have the profile (typ X typ => typ), and the corresponding subprogram, which needs to have the profile (row-of-typ => typ). To use this for the builtin concatenation (many compilers special case this, we just added this kind of special casing to GNAT), you also need to deal with rowing of elements, i.e. if the operand typ is itself row-of-component, then you allow components in the list with automatic rowing operations. P.S. the above uses ALgol-68 notation and terminology, which is highly convenient in a case like this: row-of-x is a type that is a single dimension array whose component type is x rowing is the coercion that takes type x to type row-of-x