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,b6e97963d32ee242 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-21 11:32:50 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!diablo.theplanet.net!mephistopheles.news.clara.net!news.clara.net!feed.news.nacamar.de!uio.no!ntnu.no!not-for-mail From: Preben Randhol Newsgroups: comp.lang.ada Subject: Re: The old "Object.Method" syntax debate Date: Wed, 21 May 2003 18:32:50 +0000 (UTC) Organization: Norwegian university of science and technology Message-ID: References: <254c16a.0305210726.485125de@posting.google.com> <3ECBA778.4070909@crs4.it> NNTP-Posting-Host: kiuk0152.chembio.ntnu.no X-Trace: tyfon.itea.ntnu.no 1053541970 16422 129.241.83.78 (21 May 2003 18:32:50 GMT) X-Complaints-To: usenet@itea.ntnu.no NNTP-Posting-Date: Wed, 21 May 2003 18:32:50 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:37609 Date: 2003-05-21T18:32:50+00:00 List-Id: David C. Hoos wrote: > > "Preben Randhol" wrote in message >> But how is it done? >> >> I mean how can the compiler know that a procedure say: >> >> procedure Marry (Person : Man; Person2 : Woman); >> >> should be able to call like this: >> >> type Him : Man; >> type Her : Woman; >> >> >> Him.Marry (Her); >> -- or >> Her.Marry (Him); >> >> If I have understood the change suggested. >> >> Would it not make the language ambigous? > > It would not make the language ambiguous. Since Him and Her > are objects of different types, each type would need its own > version of the Marry procedure, unless they were both derived > from a common ancestor type which had a class-wide Marry > procedure. This means that this method will depend upon which type is defined as the first argument. So then one need to do: procedure Marry (Person : in out Man; Muse : in out Woman) is begin -- Exchange rings and all end; procedure Marry (Muse : in out Woman; Person : in out Man); is begin Person.Marry (Muse); end; This isn't more verbose than: Relations.Marry (Joe, Jane); Besides now there is a subtle "the type owning the procedure must be listed first" rule. Can one then still do something like: procedure Marry (Person : in out Man; Muse : in out Woman; Place : in Location) Joe.Marry (Place => Church, Muse => Jane); -- Preben Randhol http://www.pvv.org/~randhol/