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.7 required=5.0 tests=BAYES_00,MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,75a8a3664688f227 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-02-02 06:00:07 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!144.212.100.101!newsfeed.mathworks.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: dmitry6243@my-deja.com Newsgroups: comp.lang.ada Subject: Re: Multiple dispatch (was Re: Parameter Modes, In In Out and Out Date: Fri, 02 Feb 2001 13:49:22 GMT Organization: Deja.com Message-ID: <95edt0$sed$1@nnrp1.deja.com> References: <7Cx56.90736$A06.3322588@news1.frmt1.sfba.home.com> <937jab$s23$1@nnrp1.deja.com> <3A57CD7F.2228BFD5@brighton.ac.uk> <938p3u$omv$1@nnrp1.deja.com> <93cagm$c1j$1@nnrp1.deja.com> <93e4e6$ucg$1@nnrp1.deja.com> <93encq$brm$1@nnrp1.deja.com> <93f6ar$m44$1@nnrp1.deja.com> <93flab$2mh$1@nnrp1.deja.com> <93fqau$6m2$1@nnrp1.deja.com> <93h9mo$bbm$1@nnrp1.deja.com> <93il87$iqo$1@nnrp1.deja.com> <93k6dv$qt6$1@nnrp1.deja.com> <93ko49$auq$1@nnrp1.deja.com> <93modu$36k$1@nnrp1.deja.com> <93n2co$alq$1@nnrp1.deja.com> <93q39q$oq0$1@nnrp1.deja.com> <93q6cd$r3k$1@nnrp1.deja.com> <93v898$k80$1@nnrp1.deja.com> <95dm8r$a9a$1@nnrp1.deja.com> NNTP-Posting-Host: 212.79.194.99 X-Article-Creation-Date: Fri Feb 02 13:49:22 2001 GMT X-Http-User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; m18) Gecko/20001108 Netscape6/6.0 X-Http-Proxy: 1.1 x53.deja.com:80 (Squid/1.1.22) for client 212.79.194.99 X-MyDeja-Info: XMYDJUIDdmitry6243 Xref: supernews.google.com comp.lang.ada:4852 Date: 2001-02-02T13:49:22+00:00 List-Id: In article <95dm8r$a9a$1@nnrp1.deja.com>, mark_lundquist@my-deja.com wrote: > If they expected triple dispatch, then they don't know Ada :-) Well, in fact Ada does have "MD", defined as follows. If all tags are same, then dispatch happens as it is expected. If the tags differ the call is "dispatched" to a "method" that raises an exception. (Quotation marks are placed for purists (:-)). Run-time exception is an obvious problem and I can easily imagine applications where such behaviour would be unacceptable. > Maybe they really expected covariance, in which case they should have > used a generic instead. > > Another possibility is that the inputs to Compute should be of type > FuzzyNumber, not FuzzyNumber'Class. Users of Compute would upcast as > necessary. (However, they somehow have to have some reason to believe > that upcasting yields a meaningful result, which is hard to know > without seeing into the implementations of the abstractions. This is > a general difficulty with programming by extension). That's another question. No programming by extension was intended. It was rather an attempt to have different respresentations for same thing (FuzzyNumber). > I'm not a computer scientist, and I haven't ever studied multiple > dispatch, so maybe this is a naive question... but don't you now have > a problem with cross-coupled sibling dependencies? Suppose I create > another type Wild_And_Wooly_Number, derived also from FuzzyNumber? > How do you fill in your table then? It is not a naive question. We could say (1) Wild_And_Wooly_Number knows nothing about SpecialFuzzyNumber. Then a definition of + for any mixture of SpecialFuzzyNumber and Wild_And_Wooly_Number is not a method => not an overriding => either an overloading or illegal. Alternatively (2) we "just" have to define (no matter implicit or explicit) all possible combinations involving Wild_And_Wooly_Number and any of existing successors of FuzzyNumber. If Wild_And_Wooly_Number does not override +, then the compiler does it implicitly (by taking an appropritate + where each appearance of Wild_And_Wooly_Number is replaced by FuzzyNumber). If a programmer overrides at least one, then there are two possibilities: either to use the default for others (= unexpected behaviour) or to force the programmer to override all of them too (= combinatoric explosion). As I already said in my previous postings, I do not know the answer. I even do not know whether the answer exists (:-() -- Regards, Dmitry Kazakov Sent via Deja.com http://www.deja.com/