From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!goblin1!goblin.stu.neva.ru!newsfeed.pionier.net.pl!pwr.wroc.pl!news.wcss.wroc.pl!not-for-mail From: antispam@math.uni.wroc.pl Newsgroups: comp.lang.ada Subject: Re: Multiple dispatch in Julia Date: Thu, 12 Nov 2020 17:56:39 +0000 (UTC) Organization: Politechnika Wroclawska Message-ID: References: <6faed833-462a-4b4b-b555-9a632fd7caddn@googlegroups.com> NNTP-Posting-Host: hera.math.uni.wroc.pl X-Trace: z-news.wcss.wroc.pl 1605203799 13176 156.17.86.1 (12 Nov 2020 17:56:39 GMT) X-Complaints-To: abuse@news.pwr.wroc.pl NNTP-Posting-Date: Thu, 12 Nov 2020 17:56:39 +0000 (UTC) Cancel-Lock: sha1:7Fo5IOiH/cpmDHi1LWRbeXfVI7w= User-Agent: tin/2.4.3-20181224 ("Glen Mhor") (UNIX) (Linux/4.19.0-10-amd64 (x86_64)) Xref: reader02.eternal-september.org comp.lang.ada:60576 List-Id: Dmitry A. Kazakov wrote: > On 12/11/2020 08:12, Jerry wrote: > > > I'm curious to know what Ada folks think about this discussion about Julia, especially the extended comment about multiple dispatch. > > What discussion? > > ----------- > Like other dynamic languages claiming that they have multiple dispatch, > Julia deploys run-time type matching for the target method. This is all > you need to know. > > Because the most important requirement of properly designed dispatch > (multiple or not) is: > > dispatch may never fail. Hmm, AFAICS typical implementation of dispatch in dynamic language may raise error "no such method". If error is undesired one can add catch all method or catch errors. Do you think that all such implementations are improperly designed? > It is very difficult to satisfy already with multi-methods. BTW, I am > not sure, but it seems that Julia has only multi-methods and no full > multiple dispatch. > > Full multiple-dispatch is even harder to approach. > > P.S. Multi-method dispatch is something like X + Y. Both arguments and > the result are from the same type hierarchy. Full multiple dispatch is > like Print (X, Y). Arguments are from different hierarchies. I am not sure what you want to say here. '+' is just funny name, why it should be different than 'Print'? Concerning hierarchies, Sevaral languages insit on "top" type, so there is only one hierarchy. Other languages have several different toplevel types, consequently there are different hierarchies originating at different toplevel types. I do not see why single hierarchy versus multiple hierarchies should decide if dispatch is multiple dispatch. In language I use there is type for equations. One can add scalar to equation or add two equations. This language uses overloading, but if another language implemented this via dipatch I would call it multiple dispatch. OTOH this language has single argument 'print'... > P.P.S. Ada in fact has multi-method dispatch. It is defined so that when > tags of controlling arguments are different you get an exception ARM > 3.9.2 (16). Which, yes, violates the principle above, but nobody ever > pretended that Ada had multiple dispatch in the first place. Maybe you talk about multi-method when types of arguments (or rather "dispatching arguments") are all equal? That would be rather unconventional definition of multi-method. -- Waldek Hebisch