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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.glorb.com!de-l.enfer-du-nord.net!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: A few Ada questions Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Fri, 24 Jul 2009 09:00:29 +0200 Message-ID: <3nffbo4zt7kp$.5i3qwunv8h7g.dlg@40tude.net> NNTP-Posting-Date: 24 Jul 2009 09:00:27 CEST NNTP-Posting-Host: 5c0f4b84.newsspool1.arcor-online.net X-Trace: DXC=QhCl;7R?`Tag`45cDR8l?oic==]BZ:afn4Fo<]lROoRa^YC2XCjHcbi<`c65>C[B[lDNcfSJ;bb[eIRnRBaCd On Thu, 23 Jul 2009 15:58:21 -0700 (PDT), Andrea Taverna wrote: > As for (4), I couldn't find a practical example of storage pools usage > on the net, I'd really like to see one. http://www.dmitry-kazakov.de/ada/components.htm > The storage pool I have in mind is the one used in ObjC/Cocoa, i.e. a > storage pool with ref-counted objects. Users can send retain/release > messages to increment/decrement the pool-allocated object's reference > count. In which way does this differ from storage pools in Ada? The above link has several implementations of storage pools as well as reference counted objects. Storage pools implementations there are used for areas (for example to allocate nodes of a parsing tree) and for implementation of doubly-linked lists (list nodes are obtained per allocation rather than per inheritance or aggregation). Reference counting GC is a related but different story. > I know that they have several benefits compared with pool-less > storage, you can define a homogeneously typed/sized pool improving the > memory management for associated types, and you can implement MM more > easily, but, still, the problems I have with MM (at least in C) are : > - application-specific code is intertwined with MM and vice versa. It > complicates interfaces and hinders reusability. Arguably, object scopes when not nested are application-specific. > - objects have a graph-like relationship on which MM depends that > could not be easy to foresee. Like above, the relation uses-required should come from the application domain. I think in most cases difficulties arise when these get intermixed with some implementation artefacts. > - due to the graph relationship, refactoring MM code, which can ease > MM itself, gets harder. I have a suspicion that MM code should not be refactored at all. In particular I am strongly against GC. > How is Ada supposed to help with this? By avoiding pointers. Ada offers various ways to do things without explicit memory allocation. > As such I'm not sure whether I can extend new containers from standard > ones, including defining new cursors, while having polymorphic > behaviour. That won't work because Ada does not have multiple dispatch (MI). When you derive from the container and from the cursor then to have it polymorphic you need operations dispatching in both container and cursor. This is MI, which is absent, alas. > For example, can I define a linked-list implemented with an array by > deriving a standard container? No, because interface inheritance from concrete types is also absent in Ada. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de