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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c08a7609345f4e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!feeder.news-service.com!weretis.net!feeder4.news.weretis.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Limited use for limited with? Date: Sat, 9 Oct 2010 01:13:33 -0500 Organization: Jacob Sparre Andersen Message-ID: References: <853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com> <36e886fa-b272-461f-bf86-a6b18366b64f@i5g2000yqe.googlegroups.com> <1eug9v5h5mf8d$.ud00hrz48lyr.dlg@40tude.net> <67044906-dacc-4526-b3f6-27e5323ab8fc@n3g2000yqb.googlegroups.com> <12chb4kbqt9ln$.zumsv1z9hqvk$.dlg@40tude.net> <292dd0bd-1fc4-4715-bb70-7655d0dc04eb@j24g2000yqa.googlegroups.com> <09c36bd6-edfa-42bf-8f33-e91b0a9b0737@26g2000yqv.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1286604815 29070 69.95.181.76 (9 Oct 2010 06:13:35 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 9 Oct 2010 06:13:35 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news1.google.com comp.lang.ada:14456 Date: 2010-10-09T01:13:33-05:00 List-Id: "Maciej Sobczak" wrote in message news:09c36bd6-edfa-42bf-8f33-e91b0a9b0737@26g2000yqv.googlegroups.com... On 5 Paz, 09:25, "Randy Brukardt" wrote: >> >No way. There are *many* Registers, meaning that a single object can >> >be registered in several registries, not just one. Will you suggest >> >passing an array of registries to the constructor? I hope not. >> >> This sounds like chaos, not a design. > >Let me guess: comp.lang.ada is the only group you are registered to, right? Yes. >And of course, you are subscribed to only one mailing list, right? More than one of those. >The possibility to register somewhere should be orthogonal to the >number of registries. If I was able to subscribe to comp.lang.ada, I >want to be able to subscribe to several other groups, too. It's not a >chaos, it's an obvious result of decoupling. But those things are registered by name (an simple text string), not registering an object. When you want to put something in lots of places, you have have an abstract way to refer to it. Yes, you can use an access type to do that, but it is a lousy solution, because of dangling pointers, because it can't be stored, because there is no structure. An example: in the Claw Builder, I tried to use access types to tie the various objects together. But it didn't work, because the structure is a graph of elements that are combined in various ways. There wasn't any way to restore the structure once it was saved to disk, saving the structure often saved elements multiple times, and similar problems. Moreover, the declarations all have to be placed in one giant package (a problem that Ada 2005 tries to solve, but not very successfully). Eventually, I changed most of "links" to use names, which are then looked up in an appropriate index. ... >> When you start with a poor design, it's not surprising you can only find >> poor solutions... >Translation: "I don't understand the purpose of the system, but the >fact that my proposed solutions are not adequate is a sure proof that >the original design must be broken." Is that right? When I'm writing an Ada program, I want a design that can be expressed well in Ada. I don't much care whether it can be expressed well in some other language. And "well" includes safety against accidental misuse. Use of access types in object interfaces almost always compromises safety. A design that can't be expressed well in Ada is a poor design (presuming you are planning to write the program in Ada). It would be the same for Java, C++, or any other programming language. I personally think that callbacks are a poor fit for Ada (possibly because I started with Ada 83, where callbacks were impossible). It's not always possible to avoid them (i.e. GUI programming), but I don't think they should ever be introduced when there is an alternative. And if you do that, you don't need the "registration" in the first place. So I think a design using callbacks and registration is a "poor design". YMMV. Randy.