comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Language lawyer question: task activation
Date: Sat, 21 Feb 2009 09:31:14 +0100
Date: 2009-02-21T09:31:16+01:00	[thread overview]
Message-ID: <1vcaimc8kjj30$.kf3rsd670ebp$.dlg@40tude.net> (raw)
In-Reply-To: 499f2c59$0$31868$9b4e6d93@newsspool3.arcor-online.net

On Fri, 20 Feb 2009 23:19:04 +0100, Georg Bauhaus wrote:

> Dmitry A. Kazakov wrote:
> 
>> It neither computes nor assigns, because construction/initialization is not
>> assignment. It is a different thing. The LHS object does not exist prior
>> construction, but does prior assignment.
>> 
>>> The word "in-place" is not in Ada, only "build-in-place".
>>>
>>> Then, a procedure returns, too. Consequently, a
>>> function returning yields a value.
>> 
>> What does it return? Note that it does return an object, that were illegal
>> because the result is limited.
> 
> I suppose it is just a wording question: When
> a function returns, there is a yield.
> 
> When a procedure P(Object: out T) returns, there
> is a yield (in Object).

No, it is not so. The actual of Object out T is constructed *prior* to call
to P. In contrast the "actual" of F return T is not constructed (when T is
limited). This is exactly the thing that worries me. Because it makes out T
and return T different, while they are evidently same.

> Assume the following language experiment:
> If T is limited, we might write
> 
>    X: constant T;
> 
> begin  -- not Ada
> 
>    T'Initialize(X, Celsius => 27.3);
> 
> or some such, with the understanding that the object
> named X will be provided by declaration, but will not
> be initialized. Instead, it will have its initial
> value when T'Initialize has returned.

Unfortunately it is impossible to have pure "out". Again, because that is
inconsistent in the same way the return statement is. You cannot pass an
non-existing object to a subprogram, be it an out parameter or a result.
The object simply does not exist, there is nothing to pass. In fact it is a
kind of raw memory being passed. Worse than that it is rather an idea of
raw memory, in the case of function result.

> Initialization is very much part of object construction in
> other languages, sometimes resource management is normally
> left to the implementation, too, like in Java, or Eiffel.

It must be clearly understood and *spelt* in the language, that
initialization is not an assignment. Initialization cannot be implemented
by any operation defined on the type of the object being initialized.
Period.

If you want to do it *consistently* (typed), you have to decompose
initialization into operations of *other* types. But it remains still
impossible without some magic, called "constructor." The best thing you can
do is to allow some hooks in the constructor to be implemented by
user-defined operations.

A constructor of T as a whole is not an operation of T in any properly
typed system.

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



  reply	other threads:[~2009-02-21  8:31 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 17:37 Language lawyer question: task activation Adam Beneschan
2009-02-19 17:57 ` Dmitry A. Kazakov
2009-02-19 23:57   ` Robert A Duff
2009-02-20 13:22     ` Dmitry A. Kazakov
2009-02-23  7:36       ` Jean-Pierre Rosen
2009-02-20  5:43   ` christoph.grein
2009-02-20 10:44     ` Dmitry A. Kazakov
2009-02-20 11:14       ` christoph.grein
2009-02-20 12:07         ` mockturtle
2009-02-20 13:22           ` Dmitry A. Kazakov
2009-02-20 16:45             ` Georg Bauhaus
2009-02-20 18:41               ` Dmitry A. Kazakov
2009-02-20 22:19                 ` Georg Bauhaus
2009-02-21  8:31                   ` Dmitry A. Kazakov [this message]
2009-02-27 23:29                     ` Randy Brukardt
2009-02-28  8:13                       ` Why constructing functions is a mess [was Language lawyer question: task activation (was: Language lawyer question: task activation)) Dmitry A. Kazakov
2009-02-28 12:20                         ` Why constructing functions is a mess [was Language lawyer question: task activation Georg Bauhaus
2009-02-28 13:45                           ` Dmitry A. Kazakov
2009-02-28 15:36                             ` Georg Bauhaus
2009-02-28 16:22                               ` Dmitry A. Kazakov
2009-02-28 17:19                                 ` Georg Bauhaus
2009-02-28 17:48                                   ` Dmitry A. Kazakov
2009-02-28 18:39                                     ` Georg Bauhaus
2009-02-28 20:17                                       ` Dmitry A. Kazakov
2009-03-02 16:13                                         ` Georg Bauhaus
2009-03-02 17:46                                           ` Dmitry A. Kazakov
2009-03-02 18:50                                             ` Georg Bauhaus
2009-03-02 21:02                                               ` Dmitry A. Kazakov
2009-03-03  7:04                                                 ` christoph.grein
2009-03-03  8:45                                                   ` Dmitry A. Kazakov
2009-03-03  9:27                                                     ` christoph.grein
2009-03-03  9:34                                                       ` Dmitry A. Kazakov
2009-03-03 19:13                                                       ` Pascal Obry
2009-03-04  5:29                                                         ` christoph.grein
2009-03-04  8:32                                                           ` Dmitry A. Kazakov
2009-03-04  9:05                                                             ` christoph.grein
2009-03-04  9:47                                                               ` Dmitry A. Kazakov
2009-02-28 23:12                             ` Maciej Sobczak
2009-03-01  8:23                               ` Dmitry A. Kazakov
2009-02-19 23:54 ` Robert A Duff
2009-02-20 10:18 ` Robert_Matthews
2009-02-20 10:34   ` christoph.grein
2009-02-20 14:16   ` Robert A Duff
2009-02-20 16:57     ` Robert_Matthews
replies disabled

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