comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Self pointer in limited record
Date: Sat, 1 Sep 2007 18:03:00 +0200
Date: 2007-09-01T18:02:40+02:00	[thread overview]
Message-ID: <1alyfwaig93sk$.99oy269uon$.dlg@40tude.net> (raw)
In-Reply-To: 46d972e8$0$30384$9b4e6d93@newsspool4.arcor-online.net

On Sat, 01 Sep 2007 16:15:44 +0200, Georg Bauhaus wrote:

> Dmitry A. Kazakov wrote:
>> On Sat, 01 Sep 2007 15:33:09 +0200, Georg Bauhaus wrote:
>> 
>>> (The true O-O programmer might suggest that we should simply
>>> pass an additional object-as-module parameter to every
>>> package subprogram... )
>> 
>> Yes, it is better to keep packages stateless.
> 
> Though by using tagged objects for a module
> and not a stateful package, you will dismiss a few
> properties of packages that can be helpful when
> modeling singleton modules:
> 
> 1 - If there is just one object in the problem domain a
> package is a perfect match and will be straight forward, safe,
> and simple to implement. No need to worry about static and
> dynamic scopes of module-objects passed around because
> there is just this one named package for the problem
> domain object.

Yes, yes, but this is a different case. Dealing with singletons, I probably
would use a [stateful] package instead of objects. Types presume multiple
instances of. Singleton in OO breaks this concept. Ada offers a cleaner
alternative. Why should we force it into a type? Let it be a package.

I think the empiric rule could be: if a package is used to declare types,
then it should have no mutable state. Otherwise it should not have type
declarations.

> 2 - Nesting packages is an option, a distinguishing feature
> of Ada IMO; a package nested inside a subprogram is a
> simple solution to the life cycle problem of module style
> objects.

Hmm, a subprogram has all properties of a package. So there is no obvious
reason why nested package (except instances of generic packages, of
course), might be useful there.

BTW, I guess child and separate packages might probably replace nested
packages. Excluding generics, I mean. Maybe if there were no generic
packages we could drop them altogether.

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



  reply	other threads:[~2007-09-01 16:03 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-04 19:31 Self pointer in limited record Maciej Sobczak
2007-07-05  8:22 ` Dmitry A. Kazakov
2007-07-05 10:35   ` Maciej Sobczak
2007-07-05 11:01     ` Pascal Obry
2007-07-05 11:14     ` Georg Bauhaus
2007-07-05 12:36     ` Dmitry A. Kazakov
2007-08-31 16:47 ` amado.alves
2007-08-31 17:09   ` Pascal Obry
2007-08-31 17:37   ` Adam Beneschan
2007-08-31 18:26   ` Jeffrey R. Carter
2007-08-31 19:33   ` Dmitry A. Kazakov
2007-09-01 13:33     ` Georg Bauhaus
2007-09-01 13:46       ` Dmitry A. Kazakov
2007-09-01 14:15         ` Georg Bauhaus
2007-09-01 16:03           ` Dmitry A. Kazakov [this message]
2007-09-01 19:49             ` Georg Bauhaus
2007-09-01 20:09               ` Dmitry A. Kazakov
2007-09-02 21:37                 ` Georg Bauhaus
     [not found]                   ` <re7ei5lc7dzf$.11qtcnh35jmzg$.dlg@40tude.net>
2007-09-03 10:51                     ` Georg Bauhaus
2007-09-03 14:17                       ` Dmitry A. Kazakov
2007-09-03 15:55                         ` Jean-Pierre Rosen
2007-09-03 19:17                           ` Dmitry A. Kazakov
2007-09-03 19:32                             ` Markus E L
2007-09-03 20:14                             ` Georg Bauhaus
2007-09-04  8:24                               ` Dmitry A. Kazakov
2007-09-04  9:36                                 ` Jean-Pierre Rosen
2007-09-04 10:14                                   ` Dmitry A. Kazakov
2007-09-05 10:49                                 ` Georg Bauhaus
2007-09-05 12:04                                   ` Dmitry A. Kazakov
2007-09-05 13:12                                     ` Jean-Pierre Rosen
2007-09-05 15:10                                       ` Dmitry A. Kazakov
2007-09-05 16:25                                         ` Jean-Pierre Rosen
2007-09-05 19:52                                           ` Dmitry A. Kazakov
2007-09-06  7:19                                             ` Jean-Pierre Rosen
2007-09-06  9:28                                               ` Dmitry A. Kazakov
2007-09-06 11:53                                                 ` Jean-Pierre Rosen
2007-09-06 15:35                                                   ` Dmitry A. Kazakov
2007-09-05 18:31                                     ` Georg Bauhaus
2007-09-05 19:52                                       ` Dmitry A. Kazakov
2007-09-05 21:38                                         ` Georg Bauhaus
2007-09-06  7:37                                           ` Dmitry A. Kazakov
2007-09-06 10:26                                             ` Georg Bauhaus
2007-09-06 12:25                                               ` Dmitry A. Kazakov
2007-09-08  1:27                                               ` Randy Brukardt
2007-09-06  9:14                                         ` Markus E L
2007-09-06  9:48                                           ` Dmitry A. Kazakov
2007-09-04  8:23                             ` Jean-Pierre Rosen
2007-10-31 23:59                           ` adaworks
2007-09-03 20:38                         ` Georg Bauhaus
2007-09-04  8:24                           ` Dmitry A. Kazakov
2007-09-03  7:54             ` Jean-Pierre Rosen
2007-09-01 15:33         ` Markus E L
2007-09-04 14:55           ` Adam Beneschan
2007-09-04 15:09             ` Jean-Pierre Rosen
2007-09-08  1:36               ` Randy Brukardt
2007-09-04 17:31             ` Georg Bauhaus
2007-09-08  1:16     ` Randy Brukardt
2007-09-10 16:27       ` amado.alves
2007-09-10 17:13         ` Adam Beneschan
2007-09-10 19:00         ` Dmitry A. Kazakov
2007-09-11  3:12           ` Randy Brukardt
2007-09-11  9:38             ` Dmitry A. Kazakov
2007-09-12 21:57               ` Randy Brukardt
2007-09-13  8:03                 ` Dmitry A. Kazakov
2007-09-13 21:37                   ` Randy Brukardt
replies disabled

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