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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,57c2a52b53b360c2 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news3.google.com!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: =?utf-8?Q?Yannick_Duch=C3=AAne_=28Hibou57?= =?utf-8?Q?=29?= Newsgroups: comp.lang.ada Subject: Re: Multiple dispatch Date: Wed, 15 Jun 2011 13:10:50 +0200 Organization: Ada @ Home Message-ID: References: <7loar137gjid$.qrn6ghii6ee$.dlg@40tude.net> <11peqoimzzkd9$.foyzy9udb4dt$.dlg@40tude.net> NNTP-Posting-Host: C6YugxKrhgMFJYeUelqZVQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org User-Agent: Opera Mail/11.11 (Linux) X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news1.google.com comp.lang.ada:19845 Date: 2011-06-15T13:10:50+02:00 List-Id: Le Wed, 15 Jun 2011 12:30:43 +0200, Natasha Kerensikova = a =C3=A9crit: > This makes the dispatch table completely isotropic and allows to > implement any element of the matrix in any compilation unit (as long a= s > it is linked (statically or dynamically) to the final binary). I found= > this feature very nice when the "glue" between the row type and the > column type does not obviously belong to either type This is a common source of design ambiguity, and that's one of the reaso= n = why I've posted this topic. It's a long time (multiple years) I have thi= s = question in mind. Each time, I encounter difficulties to do a choice. A common and simple example, while not related to dispatching, is stream= = operations : although its clear a input/ouput method must have two = arguments, one for the stream and one for the data, how do you decide th= e = operation belongs to the package defining the type or to the package = defining the stream. This one is not the worst, as you would say : if th= e = type is primitive enough, it will belongs to the stream package, and if = = the type is complex, it will belong to the package defining the complex = = type. Reasonable enough ? Not the worst, but expose an example of this common question : does this= = method should belong to this or that type/package ? Finally the question about multiple dispatch ends to be similar. > I know other high-level languages do have introspection mechanisms, bu= t > I haven't seen anything like that in Ada. Have I missed them? I guess this would disallow many kind of binary code optimization. If on= e = need introspection, the he/she have to explicitly implement it. = Introspection comes as more natural to interpreted language than to = compiled language. Or else, may be you are thinking about compilers awar= e = of introspection as they actually are of dispatching ? This would requir= e = to mark some type as requiring introspection, like you mark some type as= = tagged and defined dispatching operation on that type. But I also feel to guess introspection is more suited to interpreted = language for another reason than the one that is comes more natural with= = the implementation of interpreted language : self modifying program. Why= = would you need introspection if that is not to apply some alteration to = = what your are inspecting ? If this is not to alter the program itself = (which is clearly a thing for interpreted language only), then that woul= d = probably be for debugging purpose then; and debugging can be done withou= t = introspection (while this can be done with introspection, as I my-self d= id = when one day I modified an Eiffel compiler that way=E2=80=A6 the compile= r was = generating code which allowed introspection when the compile-for-debug = flag was On). -- = =E2=80=9CSyntactic sugar causes cancer of the semi-colons.=E2=80=9D [Ep= igrams on = Programming =E2=80=94 Alan J. =E2=80=94 P. Yale University] =E2=80=9CStructured Programming supports the law of the excluded muddle.= =E2=80=9D [Idem] =E2=80=9Cc++; /* this makes c bigger but returns the old value */=E2=80=9D= [Anonymous]