comp.lang.ada
 help / color / mirror / Atom feed
From: "Paweł 'Nivertius' Płazieński" <nivertius@gmail.com>
Subject: Re: Access to function returning class-wide type
Date: Thu, 21 Aug 2008 21:30:28 +0200
Date: 2008-08-21T21:30:28+02:00	[thread overview]
Message-ID: <g8kg18$48s$1@registered.motzarella.org> (raw)
In-Reply-To: 9bmxv7t985ke$.p14upop2x80z.dlg@40tude.net

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"



  reply	other threads:[~2008-08-21 19:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-21 10:13 Access to function returning class-wide type Paweł 'Nivertius' Płazieński
2008-08-21 10:33 ` Paweł 'Nivertius' Płazieński
2008-08-21 11:02 ` Dmitry A. Kazakov
2008-08-21 11:56   ` Paweł 'Nivertius' Płazieński
2008-08-21 13:34     ` Dmitry A. Kazakov
2008-08-22  4:53       ` Randy Brukardt
2008-08-22 23:50         ` Randy Brukardt
2008-08-21 12:01 ` Georg Bauhaus
2008-08-21 13:01   ` Paweł 'Nivertius' Płazieński
2008-08-21 13:50     ` Dmitry A. Kazakov
2008-08-21 19:30       ` Paweł 'Nivertius' Płazieński [this message]
2008-08-21 20:56         ` Dmitry A. Kazakov
2008-08-22  7:34           ` Paweł 'Nivertius' Płazieński
2008-08-21 17:02 ` Adam Beneschan
2008-08-21 19:22   ` Paweł 'Nivertius' Płazieński
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox