comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why constructing functions is a mess [was Language lawyer question: task activation
Date: Mon, 2 Mar 2009 22:02:24 +0100
Date: 2009-03-02T22:02:27+01:00	[thread overview]
Message-ID: <7uqw8skbd6y0.ijm97ivq4kei.dlg@40tude.net> (raw)
In-Reply-To: 49ac2a8e$0$30232$9b4e6d93@newsspool1.arcor-online.net

On Mon, 02 Mar 2009 19:50:53 +0100, Georg Bauhaus wrote:

> Dmitry A. Kazakov schrieb:
>> On Mon, 02 Mar 2009 17:13:09 +0100, Georg Bauhaus wrote:
>> 
>>> Dmitry A. Kazakov schrieb:
>>>
>>>> A derived type works fine:
>>>>
>>>>    type My_Plant is new Power_Plant with null record;
>>>>    function Create return My_Plant is
>>>>    begin
>>>>       return (Power_Plant'(Create ("my plant")) with null record);
>>>>    end Create;
>>>> Now, the point is that this model of construction does not work with
>>>> abstract types because of fundamental reasons. It is not (<>) which is
>>>> broken, but the construction model.
>>> OK, got your point, sorry for being so dense.
>> 
>> No, you still have not.
> 
> Yes, (Abstract_Function_Call with ...) doesn't hold water,
> I think I got it.  Constructor functions are not constructors for
> "abstract subobjects", they are primitive which is doubtful
> (as is explained in a 1994 thread Constructor in ADA9X) and
> so on...

They are not constrictors for ALL subjects. For abstract ones is just
absolutely evident.

> Please let the ARG know, in case this has been overlooked.

I don't think they did. Anyway, long ago I posted a proposal for
constructors to Ada-Comment. (I also posed it to comp.lang.ada.)

In my eyes it makes absolutely no sense to consider what could be done with
constructing functions, limited aggregates, return statements etc. Nothing
should be. Leave them as they are. The idea I am trying to convey, is that
it cannot be fixed. Move this mess to the Annex J and do construction
(destruction, initialization, factories) *right*.

> (The compiler bug is still a bug insofar as no constructor
> function is needed to crash it. This dreadful line in einfo.adb
> seems to apply in the case of Ada 95 only.)

[...]

Your example does not crash GNAT Pro 6.2.1.

> ...
>    package P1 is
>       type T1(<>) is abstract tagged limited private;
>    private
>       type T1(X: Character) is tagged limited null record;
>    end P1;
> 
>    package P2 is
>       type T2 is new P1.T1 with private;
>    private
>       type T2 is new P1.T1 with null record;
>       X: T2 := (P1.T1 with null record);  -- Bang!
>    end P2;
> ...

However it looks like a bug to me, because T1 is unconstrained.
Nevertheless, GNAT Pro 6.2.1 successfully compiles it.

P.S. The version 6.2.1 is much better than earlier versions. All bugs I
reported (and there were many) are now fixed. Though I didn't report all
assumed bugs since some of them (traditionally in generics) are very tricky
to track down.

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



  reply	other threads:[~2009-03-02 21:02 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
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 [this message]
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