From: "J-P. Rosen" <rosen@adalog.fr>
Subject: Re: What is your opinion on Global Objects?
Date: Sat, 22 Nov 2014 08:46:36 +0100
Date: 2014-11-22T08:46:36+01:00 [thread overview]
Message-ID: <m4pf0h$a10$1@dont-email.me> (raw)
In-Reply-To: <1tz9u84opgdwc$.a7dpkorp05gp.dlg@40tude.net>
Le 21/11/2014 10:01, Dmitry A. Kazakov a écrit :
> On Thu, 20 Nov 2014 22:35:16 +0100, J-P. Rosen wrote:
>
>>> 1. You are hardcoded to a particular implementation (i.e. no dispatching)
>> Yes, it is more static, therefore safer and more easily provable.
>
> This is a bit contradictory. Proofs as such are always against some stated
> things. That already presumes several instances. Some instances may
> withstand the proof some don't. Thus the idea of proving an inherent
> singleton looks somewhat dubious. Singleton is only in the usage not a
> property.
Not at all. Where we differ is that you are thinking in terms of classes
first, then instances. You see the properties at class level, and then a
singleton (a class with a single instance) makes little sense.
I am thinking in terms of objects first. Objects have properties. If
several objects share a common behaviour, then I group them into
"equivalence classes", and the common properties of the objects become
the properties of the class. If you think objects first, singletons make
perfect sense.
> And you forgot about reuse. A singleton implementation may use some other
> types implementations or provide its implementation for reuse.
You implicitely think of reuse by inheritance. I favor reuse by composition.
>
>>> 3. The majority of the program becomes impure
Not really. If your problem requires a global state, then it is
"impure". Whether you use global variables in a package or a global
object gathering the data that you pass to subprograms does not change
anything.
>>> 5. Everything is compile-time constant (i.e. no creating or deleting things dynamically).
>> I would regard this as a huge benefit - dynamicity has always been
>> opposed to simplicity and provability.
>
> Huh, that reminds me of a relatively fresh discussion about termination of
> a library-level task in Ada. A typical singleton, isn't it? Yet impossible
> to terminate on application exit!
??? Select ... or terminate works perfectly well for library tasks. I do
that all the time.
--
J-P. Rosen
Adalog
2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX
Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00
http://www.adalog.fr
next prev parent reply other threads:[~2014-11-22 7:46 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-18 1:36 What is your opinion on Global Objects? Hubert
2014-11-18 2:52 ` Jeffrey Carter
2014-11-18 3:08 ` Hubert
2014-11-18 3:16 ` Shark8
2014-11-18 5:09 ` Jeffrey Carter
2014-11-18 11:23 ` Brian Drummond
2014-11-19 2:50 ` Hubert
2014-11-19 3:03 ` Jeffrey Carter
2014-11-19 9:13 ` Hubert
2014-11-19 10:22 ` J-P. Rosen
2014-11-19 17:37 ` Jeffrey Carter
2014-11-20 16:34 ` Stephen Leake
2014-11-20 21:11 ` Adam Beneschan
2014-11-21 15:25 ` Stephen Leake
2014-11-21 21:53 ` Randy Brukardt
2014-11-21 1:25 ` Hubert
2014-11-21 3:00 ` Brad Moore
2014-11-19 10:11 ` Jacob Sparre Andersen
2014-11-20 6:21 ` Hubert
2014-11-18 8:54 ` Dmitry A. Kazakov
2014-11-20 20:33 ` sbelmont700
2014-11-20 21:35 ` J-P. Rosen
2014-11-21 1:02 ` sbelmont700
2014-11-21 1:31 ` Hubert
2014-11-21 9:01 ` Dmitry A. Kazakov
2014-11-22 7:46 ` J-P. Rosen [this message]
2014-11-22 9:02 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox