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.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,604e0f87aa06eab6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-03-27 11:45:44 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news.isc.org!sjc70.webusenet.com!chi1.webusenet.com!news.webusenet.com!cyclone1.gnilink.net!spamkiller2.gnilink.net!nwrdny02.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: <7eee7v4hpvj0i5s345uonlen5315rhiau8@4ax.com> <4dkea.75440$gi1.38045@nwrdny02.gnilink.net> <5115eb96.0303220201.44527637@posting.google.com> <5115eb96.0303232053.2fcc7d78@posting.google.com> <5115eb96.0303242148.57027600@posting.google.com> <6Y_fa.5102$kU.534@nwrdny01.gnilink.net> Subject: Re: Imitation is the sincerest form of flattery X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Thu, 27 Mar 2003 19:45:42 GMT NNTP-Posting-Host: 141.157.180.238 X-Complaints-To: abuse@verizon.net X-Trace: nwrdny02.gnilink.net 1048794342 141.157.180.238 (Thu, 27 Mar 2003 14:45:42 EST) NNTP-Posting-Date: Thu, 27 Mar 2003 14:45:42 EST Xref: archiver1.google.com comp.lang.ada:35767 Date: 2003-03-27T19:45:42+00:00 List-Id: "Dmitry A. Kazakov" wrote in message news:b5qcnq$2bshmf$1@ID-77047.news.dfncis.de... > Frank J. Lhota wrote: > > > I wish that we had the following functions defined in the Standard > > package: > > > > function Pred( X : Integer ) return Integer; > > function Max( X, Y : Integer ) return Integer; > > -- etc. > > > > This would allow the programmer to re-define any of these attributes for > > types derived from Integer (or other predefined types). > > True, but it is a very long way to go. For example, to have 'Max > dispatching, you would immediately need true multiple dispatch - it has two > parameters! AFAIK (and my testing seems to confirm this) if we have the function function Max( X, Y : An_Integer_Type ) return An_Integer_Type; defined in the same package as An_Integer_Type, and if we derive a type New_Integer from An_Integer_Type, i.e. type New_Integer is new An_Integer_Type; then New_Integer inherits Max from An_Integer_Type, i.e. there is an implicit function function Max( X, Y : New_Integer ) return New_Integer; that the programmer can either call or replace with his own version. Multiple dispatching would only be an issue if we wanted to generate a version of Max that compares and / or returns different integer types. By the very nature of the Max function, we are unlikely to even want to do that. This is not to dismiss the utility of multiple dispatching, but unfortunately most OOPL's avoid it because of efficiency concerns.