comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Self pointer in limited record
Date: Fri, 7 Sep 2007 20:36:08 -0500
Date: 2007-09-07T20:36:08-05:00	[thread overview]
Message-ID: <fbsu4q$mvi$1@jacob-sparre.dk> (raw)
In-Reply-To: jfsjbf.smp.ln@hunter.axlog.fr

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1740 bytes --]

"Jean-Pierre Rosen" <rosen@adalog.fr> wrote in message
news:jfsjbf.smp.ln@hunter.axlog.fr...
> Adam Beneschan a �crit :
>
> > The trouble is, I can think of several occasions in which I assumed an
> > object could only have one instance---and then later found reason to
> > wish I had written it so that there could be two.
> >
> > No, this doesn't happen in all cases.  But it seems to me it happens
> > often enough that one should carefully examine any assumption that
> > there can be only one instance.  Or be prepared to go back and make
> > some major changes later.
> >
> If you implemented your singleton as a package, it is quite an automatic
> transformation:
>
> - Add a (normally private) type to the specification
> - Implement it as a record whose components are all the global (state)
> variables of the package
> - Add a parameter of this type to every subprogram provided by the
> package, and in the bodies, change the references to  the global
> variables to the corresponding field of the new parameter.

I'd call it rote perhaps, but it is nowhere near automatic. Changing the
references of the globals alone can take hours (there is no prefix to change
with an automatic tool, and the names typically conflict with other
entities). Moreover, you also have to change the comments to match, and
especially the error handling (which often will need more detailed exception
information in order to be able to tell which instances are involved).

If you think it is so easy, I have a number of packages (and the programs
that use them) that need such an update. Where should I send the source??
;-)

After all, most programming is rote, but very little can really be
automated.

                              Randy.





  reply	other threads:[~2007-09-08  1:36 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
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 [this message]
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