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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1e36228aae0595da X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!newsfeed.straub-nv.de!news.motzarella.org!motzarella.org!not-for-mail From: =?ISO-8859-2?Q?Pawe=B3_=27Nivertius=27_P=B3azie=F1ski?= Newsgroups: comp.lang.ada Subject: Re: Access to function returning class-wide type Date: Thu, 21 Aug 2008 21:30:28 +0200 Organization: A noiseless patient Spider Message-ID: References: <48ad5922$0$20706$9b4e6d93@newsspool4.arcor-online.net> <9bmxv7t985ke$.p14upop2x80z.dlg@40tude.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8Bit X-Trace: feeder.motzarella.org U2FsdGVkX19FSemr7dcYxdEh1FKvO/zXAaZLHDawErPKJO7Dn6IaxDNT5OGZIaHHphOUhT4RDxxfs5O+YluPI5PKMDPZKwnZdLTgD1FG/JyzLirXkh1JV98qtcnwdMrQz+xDOUD9H9xfckXzg5rVxA== X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Thu, 21 Aug 2008 19:35:05 +0000 (UTC) X-Auth-Sender: U2FsdGVkX19c1kOeXpvywRpe47ywF/4/tudrJc2uMHFOKKjwNCnGJA== Cancel-Lock: sha1:E88no7SsjGqttSeu7QHNE8ljiCY= User-Agent: KNode/0.10.9 Xref: g2news2.google.com comp.lang.ada:7466 Date: 2008-08-21T21:30:28+02:00 List-Id: Dmitry A. Kazakov wrote: > So you could replace it with a map condition->type tag and then proceed > with Ada.Tags.Generic_Dispatching_Constructor, because the map > tag->constructor is for free, here you do not need pointers any more, in > Ada 2005. The compiler will force to override the "constructor" for each > concrete derived type. > ------------- > Having said that, there still is a difficult problem with construction of > the map. I don't know if it is an issue for you, but it is for the > persistency layer I designed. The problem is that if the map is > open-ended, you need some mechanism of registration of each new type in > the map. This is still unresolved in Ada. The pattern I am using is that > each package declaring a new type is required to call some class-wide > procedure registering the type upon package elaboration. In your case it > is the condition associated with the type tag. That cannot be enforced, > and it works only at the library level, i.e. for "immortal" types. I think that the map condition->type tag is in my case same problem as map condition->constructor pointer. I need the map registration anyway, because it basically needs to be changed at run-time. Altrough, all the types I need to register are library-level types, so the registration mechanism is pretty simple. > A possible solution in the future language revisions could be to introduce > type constructors/destructors: user-defined procedures called upon > derivation and leaving the scope of a type. I can't wait to see that :-) -- Pawe� P�azie�ski aka Nivertius "In the end, there will be Ada, XML and gzip"