comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Design of cross referring types/classes and proper usage of containers
Date: Wed, 5 Aug 2015 09:37:33 +0200
Date: 2015-08-05T09:37:33+02:00	[thread overview]
Message-ID: <p7gwwx2xixzl$.ihs0eqccjgmo.dlg@40tude.net> (raw)
In-Reply-To: 3341271b-4926-40cb-a9aa-660522d56f24@googlegroups.com

On Tue, 4 Aug 2015 12:00:28 -0700 (PDT), Serge Robyns wrote:

> Given static (immutable data) one one hand and dynamic data (changed
> during the execution) on the other hand; stored in various containers. 
> What is actually the best approach? Shall I Storing the full element of
> objects or references created through new T_xyz?

That depends on the semantics of mutators. If the semantics is referential,
e.g. you change the object in one place and all logical references get
aware of the change, the only way (that does not involve global variables
and distributed overhead) is having physical references.

Things like MVC require referential semantics.

> Shall I Storing the full element of
> objects or references created through new T_xyz?

You could have a constructing function that hides ugly allocator. E.g. when
using strong references you might have:

    function Create (...) return Handle;

which internally allocates some private limited object the tagged Handle
points to. Handle can be copied around and stored into a container. [*]

> If I want to use an access variables in the first method, do I need to
> pass an aliased type?

Aliased objects, yes. However some types have only aliased instances.

----------------
* Yet another possible reason against using aggregation is that you cannot
put limited members into non-limited records, for obvious reasons. But a
handle is non-limited.

E.g. in GtkAda the widget type is non-limited. The effect is that you
cannot put a task or a protected object or a limited container into a
widget. In Ada "limitness" is transitive upon inheritance.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


  parent reply	other threads:[~2015-08-05  7:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 16:08 Design of cross referring types/classes and proper usage of containers Serge Robyns
2015-08-03 16:14 ` Serge Robyns
2015-08-03 20:17   ` Georg Bauhaus
2015-08-03 16:22 ` Dmitry A. Kazakov
2015-08-04 11:43   ` Serge Robyns
2015-08-04 12:13     ` Dmitry A. Kazakov
2015-08-04 19:00       ` Serge Robyns
2015-08-04 19:20         ` Jeffrey R. Carter
2015-08-04 20:27         ` Randy Brukardt
2015-08-04 21:21         ` Simon Wright
2015-08-08 11:25           ` Serge Robyns
2015-08-09  3:11             ` Randy Brukardt
2015-08-09 13:33               ` Serge Robyns
2015-08-05  7:37         ` Dmitry A. Kazakov [this message]
2015-08-05 17:51           ` Serge Robyns
2015-08-05 19:21             ` Dmitry A. Kazakov
2015-08-06  7:00               ` Georg Bauhaus
replies disabled

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