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=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!caip!nike!cad!ucbvax!BD.SEI.CMU.EDU!Robert.Firth From: Robert.Firth@BD.SEI.CMU.EDU Newsgroups: net.lang.ada Subject: Overloading and Procedures Message-ID: <8606112116.AA04937@bd.sei.cmu.edu> Date: Wed, 11-Jun-86 17:16:00 EDT Article-I.D.: bd.8606112116.AA04937 Posted: Wed Jun 11 17:16:00 1986 Date-Received: Sat, 14-Jun-86 05:17:11 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: Sorry, but I see very little problem with the interaction between parametric procedures and the overloading rules of Ada. Of course, the more kinds of things you overload, the more different types of ambiguity you get. The important things, surely, are that these ambiguities should not arise in unexpected places, and that, when they do arise, they should be resolvable. Well, I said earlier that there were FEW cases where parametric procedures were necessary, and I stand by that. Therefore, you won't see many routines defined with parametric procedures, and those you do, like GAUSSIAN_QUADRATURE, will be pretty unambiguous. Now, suppose you really do get tripped up by Anyproc("+") There are several ways to disambiguate this. By using named association, for instance: Anyproc(TEXT=>"+") Anyproc(OPERATION=>"+") Or by dot qualification Text_Handling.Anyproc("+") Or by type qualification Anyproc(STRING'("+")) Now, you can't type-qualify the operation "+" in TODAY's Ada, because it doesn't have a type; it's just function "+" (Left,Right:Integer) return Integer But in an Ada with first-class procedures, that would surely be written type Binary_Integer_Operation is function (Left,Right:Integer) return Integer; "+" : Binary_Integer_Operation; and you would write, therefore, Anyproc(Binary_Integer_Operation'("+")) On to enumerals. I concede that the fiction that an enumeration literal is a parameterless function is just that: a fiction. My choice would be to abandon that fiction and hence say that you can't pass an enumeration literal actual if the formal is a function. And in all other cases, type-qualification can resolve any ambiguity. Robert Firth