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!think!nike!cad!ucbvax!YALEVMX.BITNET!GILBERT From: GILBERT@YALEVMX.BITNET Newsgroups: net.lang.ada Subject: Overloading procedures with objects Message-ID: <8606112104.AA28684@ucbvax.Berkeley.EDU> Date: Wed, 11-Jun-86 15:28:00 EDT Article-I.D.: ucbvax.8606112104.AA28684 Posted: Wed Jun 11 15:28:00 1986 Date-Received: Sat, 14-Jun-86 05:07:15 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet List-Id: The problem with procedure parameters, it seems to me, is as much a question of overloading resolution as type checking. Once the language rules were set up, the designers may have written themselves into a corner which precludes procedure arguments. Two items trouble me: Anyproc("+"); Today this will match a procedure of that name with a string argument. With procedure arguments, it is now overloaded on all procedures named Anyproc which take function arguments with darn near any two arithmetic arguments. Furthermore, even if you added procedure-types to the language you could not resolve the overloading since "+" is builtin and is therefore an anonymous procedure type (just as numeric literals are formally of type "universal_integer" which is anonymous and never explicitly defined. There is no reasonable way to state just what "+" you mean. A somewhat less difficult problem is posed by the convention that enumeration literals are syntatically treated as parameterless functions which return a value of the enumeration type. Today it is possible: type PLACE is (IN, OUT); procedure WHERE(X:PLACE); But now if I could declare another WHERE which took as its argument a "Function without arguments which returns PLACE" and then wrote: WHERE (IN); Which of the two separate WHERE routines am I calling. How syntatically can I qualify IN to distinguish whether I want it evaluated (to produce a value of type PLACE and call the first WHERE) or left as a procedure (to call the second one). More importantly, do I want the compiler to have to deal with overloading between symbols which are not just of different types but also really of qualitatively different categories. It may be possible to define extentions of a language like PASCAL which do type checking on procedure parameters, but the language will not have overloading. It may even be possible with great difficulty to define a language with overloading and parameter procedures. But I do not think that the process will survive the syntatic peculiarities that Ada introduced when permitting redefinable primitives, derived functions, and overloaded enumeration literals.