From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Default value for a record component
Date: Mon, 23 Jul 2007 21:41:38 +0200
Date: 2007-07-23T21:41:38+02:00 [thread overview]
Message-ID: <5met5cfc4qpc$.1ahrdby7cfc32.dlg@40tude.net> (raw)
In-Reply-To: 1185218266.914312.155690@n60g2000hse.googlegroups.com
On Mon, 23 Jul 2007 12:17:46 -0700, Maciej Sobczak wrote:
> On 22 Lip, 23:44, Robert A Duff <bobd...@shell01.TheWorld.com> wrote:
>
>> If you want to hide both
>
> The point is I don't.
>
> The C++ version:
>
> class T
> {
> public:
> T() : V(getDefault()) {}
>
> int V;
>
> private:
> static int getDefault();
> };
>
> (or even I can hide getDefault in the implementation file completely,
> without even mentioning it in the class definition)
>
>>> Ada needs real constructors, not just initial values.
>
>> I don't get it. Please explain.
>
> The visibility of a component and the mechanics of computing its
> initial value are orthogonal and should not depend on one another. I
> can have completely separate reasons to expose or hide either of them.
(see Jeff Carter's post)
You are barking at a wrong tree. It looks more like an abstract member
interface. So that you could declare that there is an Integer component V
in T, while hiding all stuff about its initialization / finalization /
reading / writing. Parent's construction is only a part of the problem.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-07-23 19:41 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-21 21:19 Default value for a record component Maciej Sobczak
2007-07-22 8:08 ` Dmitry A. Kazakov
2007-07-22 19:44 ` Maciej Sobczak
2007-07-22 21:44 ` Robert A Duff
2007-07-23 19:17 ` Maciej Sobczak
2007-07-23 19:41 ` Dmitry A. Kazakov [this message]
2007-07-22 20:01 ` Jeffrey R. Carter
2007-07-24 1:27 ` Randy Brukardt
2007-07-24 9:54 ` Maciej Sobczak
2007-07-24 19:12 ` 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