comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Why are Ada compilers difficult to write ?
Date: Fri, 22 Jun 2018 14:11:25 +0200
Date: 2018-06-22T14:11:25+02:00	[thread overview]
Message-ID: <pgip1c$1tl9$1@gioia.aioe.org> (raw)
In-Reply-To: 2d287ba3-209d-4d6a-af79-77177a137885@googlegroups.com

On 2018-06-22 13:46, Dan'l Miller wrote:
> On Friday, June 22, 2018 at 12:01:37 AM UTC-5, J-P. Rosen wrote:
>> Le 21/06/2018 à 22:18, Dan'l Miller a écrit :
>>> Pascal, what makes freezing rules difficult when writing Ada compilers?
>>> 1) Is it that the freezing occurs later than what the compiler writer
>>> would find convenient, forcing the compiler writer to keep clay soft
>>> when it already seems to be in the kiln?> 2) Is it that freezing occurs prematurely, requiring the compiler
>>> writer to expend effort enforcing the freezing too early for no good
>>> reason?> 3) Is it that freezing rules are non-uniform/arbitrary/capricious
>>> across language constructs?> 4) Something else?
>>> 5) All of the above?
>>
>> I'm not Pascal ;-), but I'll answer these...
>> Please do not assume that language designers are masochists that make
>> the language unnecessarily complicated for no good reason. There are
>> good reasons, and these can usually be found in the annotated reference
>> manual.
> 
> I was merely trying to enumerate all the logically possible ways that freezing rules could make it harder on the compiler writer to which Pascal was referring.  Pascal is implying some sort of pain there.  I am trying to understand that pain more precisely than a terse “why?” would evoke.
> 
>> For example, if freezing happened at the end of a package (as you
>> suggest), it would not be possible to declare a variable or a constant
>> in the same package as its type (the type has to be frozen - i.e. its
>> representation determined - for an object to be declared). Therefore,
>> the declaration of an object freezes the type. Then, when you freeze a
>> type, of course you have to freeze all types of subcomponents. etc...
>> You end up with 13.14.
> 
> Well, in an alternate universe, there would be a way to accomplish those declarations of constants or variables in the same package as their subtypes.  In the alternate-universe Ada, Ada would have borrowed (on steroids in spades) the C++ idea of postponement/deferral of settling those affairs until the closing semicolon at the terminating end of the private section of the package.  A dependency graph would have naturally arisen among the various not-yet-frozen declarations.  If the dependency graph lacks a cycle of •conflicting• semantic requests among the declarations, then simply walk the dependency graph at the time of this later freezing, settling all requested affairs during  postponement/deferral roughly analogous to the way C++ later compiles member-function bodies during its class-closing-} postponement/deferral.

It is not a good idea IMO, regardless freezing rules. Ada's approach is 
"asymmetric", i.e. forward declarations or limited with declare certain 
aspects of the type or object limiting its use before full declaration.

An example why C++'s "symmetric" approach is not that good is this:

    type A is record
       Inner : B;
    end record;

    type B is record
       Inner : A;
    end record;

I bet outlining the rules necessary to handle such cases would take much 
longer than current freezing rules. And understanding them would be 
beyond normal programmer.

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

  reply	other threads:[~2018-06-22 12:11 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-19 21:33 Why are Ada compilers difficult to write ? Vincent
2018-06-19 21:43 ` Paul Rubin
2018-06-19 22:11   ` Lucretia
2018-06-24 17:33     ` Paul Rubin
2018-06-24 17:39       ` Lucretia
2018-06-19 22:01 ` Jacob Sparre Andersen
2018-06-19 22:18   ` Lucretia
2018-06-21 14:02     ` Jacob Sparre Andersen
2018-06-21 17:20       ` Lucretia
2018-06-19 22:17 ` Lucretia
2018-06-19 22:34 ` Dan'l Miller
2018-06-22 13:01   ` Alejandro R. Mosteo
2018-06-20  8:33 ` gautier_niouzes
2018-06-20 15:54 ` Jeffrey R. Carter
2018-06-20 17:54   ` Dan'l Miller
2018-06-20 18:18     ` Dan'l Miller
2018-06-20 18:58     ` Luke A. Guest
2018-06-20 19:37       ` Dan'l Miller
2018-06-20 19:39         ` Dan'l Miller
2018-06-20 19:50         ` Dan'l Miller
2018-06-20 21:26         ` Luke A. Guest
2018-06-27 14:19         ` Olivier Henley
2018-06-27 15:34           ` Dan'l Miller
2018-06-27 16:26             ` Olivier Henley
2018-06-27 16:50               ` Dan'l Miller
2018-06-27 17:53                 ` Olivier Henley
2018-06-27 18:49                   ` Dan'l Miller
2018-06-28 11:54                     ` Mehdi Saada
2018-06-29  3:34                 ` Paul Rubin
2018-06-29 16:36                 ` G. B.
2018-06-29 17:02                   ` Dan'l Miller
2018-06-21 10:44     ` Marius Amado-Alves
2018-06-21 12:45       ` Dan'l Miller
2018-06-21 21:08         ` Paul Rubin
2018-06-21 21:42           ` Dan'l Miller
2018-06-21 22:01             ` Simon Wright
2018-06-21 23:04               ` Dan'l Miller
2018-06-22  0:20                 ` Dan'l Miller
2018-06-22  3:41                 ` Paul Rubin
2018-06-29 21:19                   ` Randy Brukardt
2018-06-22  3:44                 ` Paul Rubin
2018-06-22 21:57                   ` Dan'l Miller
2018-06-22 23:15                     ` Luke A. Guest
2018-06-23  1:03                       ` Dan'l Miller
2018-06-23  1:49                         ` Luke A. Guest
2018-06-23  2:54                           ` Dan'l Miller
2018-06-23 14:48                             ` Dennis Lee Bieber
2018-06-23 14:41                         ` Dennis Lee Bieber
2018-06-25  5:55                           ` Simon Clubley
2018-06-29 21:22                     ` Randy Brukardt
2018-06-22  3:31             ` Paul Rubin
2018-06-22 16:44         ` antispam
2018-06-22 13:11     ` Lucretia
2018-06-22 17:10       ` Simon Clubley
2018-06-22 18:00         ` Lucretia
2018-06-25  5:48           ` Simon Clubley
2018-06-25  8:46             ` Alejandro R. Mosteo
2018-06-25 13:23             ` Lucretia
2018-06-25 17:24               ` Simon Clubley
2018-06-25 14:59             ` Dan'l Miller
2018-06-25 17:32               ` Simon Clubley
2018-06-29 21:26             ` Randy Brukardt
2018-06-23  5:56         ` J-P. Rosen
2018-06-23 12:44           ` Dan'l Miller
2018-06-23 16:14             ` Shark8
2018-06-23 18:12               ` Dan'l Miller
2018-06-23 18:47                 ` Shark8
2018-06-23 19:35                   ` Simon Wright
2018-06-25  8:51               ` Alejandro R. Mosteo
2018-06-24 13:41             ` Jacob Sparre Andersen
2018-06-25  6:04               ` Simon Clubley
2018-06-25  6:31                 ` Jacob Sparre Andersen
2018-06-25 13:27               ` Lucretia
2018-06-25 20:07                 ` Dirk Craeynest
2018-06-28 12:08                   ` Vincent
2018-06-28 12:21                     ` Simon Wright
2018-06-28 12:24                     ` Luke A. Guest
2018-06-28 12:41                     ` Dan'l Miller
2018-06-28 14:43                     ` J-P. Rosen
2018-06-28 18:26                       ` Dmitry A. Kazakov
2018-06-29 21:35               ` Randy Brukardt
2018-06-29 21:29         ` Randy Brukardt
2018-06-21 17:42 ` Pascal Obry
2018-06-21 20:18   ` Dan'l Miller
2018-06-22  5:01     ` J-P. Rosen
2018-06-22  7:16       ` Dmitry A. Kazakov
2018-06-22 11:46       ` Dan'l Miller
2018-06-22 12:11         ` Dmitry A. Kazakov [this message]
2018-06-22 12:35           ` Dan'l Miller
2018-06-22 15:55             ` Dmitry A. Kazakov
2018-06-29 21:43         ` Randy Brukardt
2018-06-25 15:33 ` Dan'l Miller
2018-10-01 18:09 ` Tucker Taft
2018-10-01 18:51   ` Lucretia
2018-10-02 12:58     ` Alejandro R. Mosteo
2018-10-02 14:23       ` Lucretia
replies disabled

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