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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,57c2a52b53b360c2 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Multiple dispatch Date: Sun, 12 Jun 2011 00:13:03 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1307855591 31792 69.95.181.76 (12 Jun 2011 05:13:11 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sun, 12 Jun 2011 05:13:11 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 Xref: g2news1.google.com comp.lang.ada:19763 Date: 2011-06-12T00:13:03-05:00 List-Id: "Yannick Duch�ne (Hibou57)" wrote in message news:op.vwwpcjicule2fv@douda-yannick... ... >An example: you have multiple object of different types rooted at a some >root type; you also have multiple containers of different types too, also >rooted at another root type. Now, say objects are all to have a >serialization methods, a different one for each type. This could be >dispatching, OK, except that you have the requirement these objects are >also to be serialized a way or another, depending on the container which >will hold the serialized datas. Add to this that you can't change this, >because this is part of some standard or any other kind of things already >fixed. Serialization is one of those problems that really requires being implemented with composition, such that every type knows how to finalize itself and dispatches properly to use the similar routine of any component types. (It's annoying that Ada compilers know how to do this automatically, given that they do it for streams and for equality, but they won't help you do it in other cases.) However, if you have external requirements that prevent you from doing that in the natural way, then some other solution will be needed. That solution is likely to look like a hack -- and that's OK, because the problem itself requires a hack (it doesn't map to a natural solution). Which is a long way of saying that there are a lot of problems that can't really be solved elegantly, and it isn't very worthwhile to look for the perfect design for such problems. Come up with some design that solves the problem and don't obsess about it too much. Randy.