comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: Full view of a private partial view cannot be a subtype
Date: Tue, 5 Dec 2017 14:43:44 -0800 (PST)
Date: 2017-12-05T14:43:44-08:00	[thread overview]
Message-ID: <f73127a6-2334-430b-80a0-0ac9b9519e89@googlegroups.com> (raw)
In-Reply-To: <p071ao$2qf$1@franka.jacob-sparre.dk>

On Tuesday, December 5, 2017 at 1:59:05 PM UTC-7, Randy Brukardt wrote:
> "Shark8" wrote in message 
> news:43498b2a-773c-454a-b0e7-ade5d6594bd4googlegroups.com...
> ...
> >Besides UIs, the one problem that springs immediately to mind is the 
> >internals of a
> >compiler's IR/parse-tree.
> 
> I can speak to this (at least somewhat), and I think the full OOP version 
> would be a nightmare.

For [only] the Parse-tree/IR?
I honestly don't see why it wouldn't work as a hierarchy, and in fact think it would naturally go that way, especially in an Ada program where you have trees all over the place: the library-hierarchy, nesting of various Ada-elements (package, subprogram, task), etc.

Additionally, there are different extensions that could be made on a particular 'node' -- say the formal generic parameters for a generic.

Here's an interesting tutorial on Pratt Parsing that illustrates the technique (albeit in Java), but while it's on parsing in-general it shows how the elements constructed can be "smart" enough to construct themselves* -- http://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/ 

* Example:
   Type If_Conditional is new Node with record
    Test   : Boolean_Expression;
    Branch : Statement_Sequence;
   end record
    --...
  
   Type If_Else_Conditional is new If_Conditional with record
     Alternative : Statement_Sequence;
   end record
   --...

> 
> Janus/Ada (originally designed in the early 1980s, before there was such a 
> thing as type extension) uses variant records controlled by enumeration 
> discriminants. That is a very effective organization in Ada, because of two 
> features of Ada not found in most other languages - case completeness and 
> variant component checks.

Variant-records are quite good, IMO. There's been several times where working in another OOP-language I've wished I could use Ada due to the case-completeness and/or component-checks. (I view the component checks as merely a special-case/-application of the completeness-checks; the coverage seems like it ought to be "the same" [or at least generalizable like a sort].)

> 
> Thus, I'm unconvinced that a compiler data structure would be any advantage 
> written in OOP (at least, if the "conventional" version was written in Ada). 
> I suspect the reason that OOP held some much advantage to many programmers 
> (read, C programmers) is that they had a language which provided no help at 
> all for "conventional" programming, while Ada already had information 
> hiding, true privacy, case completeness, variant component checks, array 
> index checks, etc. So the increment is so much less.
> 
> I think the only place OOP really holds an advantage is for programs based 
> around call-backs (like most GUIs). And I think you'd be nuts to use 
> call-backs if you don't have to, so there isn't much need for OOP (assuming 
> it is compared to "conventional" Ada and some some other language that lets 
> one do anything, no matter how unintended).

The above example does make use of the "use a classwide object to get around passing a subprogram" trick that was mentioned here on C.L.A a few years back -- http://computer-programming-forum.com/44-ada/30caa21641c1ed2d.htm

  reply	other threads:[~2017-12-05 22:43 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-03  2:14 Full view of a private partial view cannot be a subtype Jere
2017-12-03 12:01 ` Jeffrey R. Carter
2017-12-03 13:33   ` Jere
2017-12-03 14:34     ` Jeffrey R. Carter
2017-12-03 17:44       ` Robert Eachus
2017-12-03 18:50         ` Simon Wright
2017-12-03 22:10           ` Robert Eachus
2017-12-03 19:03         ` Jeffrey R. Carter
2017-12-03 22:23       ` Jere
2017-12-04  8:25         ` Dmitry A. Kazakov
2017-12-04 18:04         ` Jeffrey R. Carter
2017-12-04 20:41           ` Jere
2017-12-04 21:48             ` Jeffrey R. Carter
2017-12-05  8:20               ` Dmitry A. Kazakov
2017-12-05 18:16                 ` Jeffrey R. Carter
2017-12-05 20:39                   ` Dmitry A. Kazakov
2017-12-05 21:38                     ` Jeffrey R. Carter
2017-12-05 12:35               ` Jere
2017-12-05 18:40                 ` Jeffrey R. Carter
2017-12-06 12:54                   ` Jere
2017-12-06 18:03                     ` Jeffrey R. Carter
2017-12-05 20:22                 ` Randy Brukardt
2017-12-05 15:27               ` Shark8
2017-12-05 18:50                 ` Jeffrey R. Carter
2017-12-05 20:59                 ` Randy Brukardt
2017-12-05 22:43                   ` Shark8 [this message]
2017-12-07  0:52                     ` Randy Brukardt
2017-12-05 20:16               ` Randy Brukardt
2017-12-05 21:29                 ` Jeffrey R. Carter
2017-12-07  0:04                   ` Randy Brukardt
2017-12-04 20:49 ` Randy Brukardt
2017-12-05 12:56   ` Jere
2017-12-05 20:12     ` Randy Brukardt
2017-12-17 15:26       ` Jere
2017-12-17 15:39         ` Dmitry A. Kazakov
2017-12-18 22:47           ` Randy Brukardt
2017-12-19  1:22             ` Jere
2017-12-19 23:16               ` Randy Brukardt
2017-12-19  1:01           ` Jere
2017-12-19  9:08             ` Dmitry A. Kazakov
2017-12-19 13:08               ` Jere
2017-12-19 13:27                 ` Dmitry A. Kazakov
2017-12-19 19:10             ` Stephen Leake
2017-12-18 20:45 ` Stephen Leake
2017-12-18 22:54   ` Randy Brukardt
2017-12-19  1:08   ` Jere
replies disabled

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