From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada OS based on Minix3
Date: Fri, 14 Nov 2008 18:11:34 -0500
Date: 2008-11-14T18:11:34-05:00 [thread overview]
Message-ID: <wcc4p29x5qx.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: 14ay3vz2ngj9s.1bmilwgckl3lc$.dlg@40tude.net
"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:
> On Tue, 11 Nov 2008 17:09:54 -0500, Robert A Duff wrote:
>> Initialization: Use function calls. They work for all types.
>> I think we've discussed this idea before, but I don't remember
>> any fundamental problems.
>
> The fundamental problem is that a constructor cannot be decomposed into
> functions. In the function body you have to construct the object before you
> return it. Who does it and what?
In Ada 2005, a constructor function creates the object via another
function call, or via an aggregate, or via an uninitialized
variable (to which it assigns components).
> Under initialization I do not mean replacing a "default" value with
> something else. I mean creation a new object (at some memory location)
> initialized by a value. It had no other value before.
That's exactly what a function call does:
X : T := F(...);
F creates a new object. In the limited case, that object _is_ X.
In the nonlimited case, it gets copied into X. Either way,
X has been turned from "raw bits" into an object of type T --
as you say, "it had no other value before."
> Doing this by a function is semantically wrong.
I agree with a lot of the rest of what you wrote,
which I snipped.
But I'm interested in discussing this particular point.
It seems to me the whole point of functions is to create
new objects. Why is this "semantically wrong"?
I understand that there are tricky issues when constructing an
object of a specific type and then returning it as a class-wide
thing, and possibly storing pointer-to-classwide into global
data structures. But I don't get what's fundamentally wrong
with using functions as constructors.
- Bob
next prev parent reply other threads:[~2008-11-14 23:11 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 14:10 Ada OS based on Minix3 Cedric.Lannock
2008-11-07 16:20 ` xavier grave
2008-11-08 3:46 ` anon
2008-11-10 8:12 ` Ivan Levashew
2008-11-10 8:58 ` Dmitry A. Kazakov
2008-11-10 9:26 ` Ivan Levashew
2008-11-10 10:11 ` Georg Bauhaus
2008-11-10 10:24 ` Jacob Sparre Andersen
2008-11-10 10:51 ` Dmitry A. Kazakov
2008-11-10 11:07 ` Ludovic Brenta
2008-11-10 11:42 ` Ivan Levashew
2008-11-10 12:04 ` Ludovic Brenta
2008-11-11 22:16 ` Robert A Duff
2008-11-12 6:28 ` Ivan Levashew
2008-11-10 10:50 ` Ivan Levashew
2008-11-10 11:01 ` Dmitry A. Kazakov
2008-11-10 15:31 ` Robert A Duff
2008-11-10 15:56 ` Dmitry A. Kazakov
2008-11-11 22:09 ` Robert A Duff
2008-11-12 9:47 ` Dmitry A. Kazakov
2008-11-13 0:58 ` Randy Brukardt
2008-11-13 17:28 ` Dmitry A. Kazakov
2008-11-13 23:25 ` Randy Brukardt
2008-11-14 9:30 ` Dmitry A. Kazakov
2008-11-14 23:11 ` Robert A Duff [this message]
2008-11-15 10:04 ` Dmitry A. Kazakov
2008-11-15 11:57 ` Programmer controlled object creation (was: Re: Ada OS based on Minix3) Georg Bauhaus
2008-11-15 12:44 ` Programmer controlled object creation Dmitry A. Kazakov
2008-11-10 10:18 ` Ada OS based on Minix3 Georg Bauhaus
2008-11-11 1:00 ` Freejack
2008-11-11 8:32 ` Martin Krischik
2008-11-11 11:09 ` Peter C. Chapin
2008-11-11 11:59 ` Georg Bauhaus
2008-11-11 14:35 ` Ludovic Brenta
2008-11-11 16:49 ` Georg Bauhaus
2008-11-13 7:10 ` Martin Krischik
2008-11-13 7:01 ` Martin Krischik
2008-11-13 6:48 ` Martin Krischik
2008-11-13 8:09 ` Thomas Locke
2008-11-13 10:16 ` Alex R. Mosteo
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox