From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Full view of a private partial view cannot be a subtype
Date: Tue, 5 Dec 2017 14:59:03 -0600
Date: 2017-12-05T14:59:03-06:00 [thread overview]
Message-ID: <p071ao$2qf$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 43498b2a-773c-454a-b0e7-ade5d6594bd4@googlegroups.com
"Shark8" <onewingedshark@gmail.com> wrote in message
news:43498b2a-773c-454a-b0e7-ade5d6594bd4@googlegroups.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.
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.
Case completeness means that adding/removing a variant is relatively easy:
most case statements that need changing are called out by the compiler. Time
has proven that it isn't even worth looking for change locations since the
compiler will point them out much quicker than one can find them. Similarly,
adding/removing/moving/modifying components in the variant either cause
compiler errors (see above) or runtime errors from accessing non-existent
components. With good testing (easy for an Ada compiler - the ACATS provides
the needed foundation), the runtime errors will point out the majority of
other changes needed. Indeed, I've been introducing additional variants into
the Janus/Ada data structures in order to get even more advantage from these
features -- they eliminate large amounts of debugging that would otherwise
been necessary.
I've never tried an OOP compiler tree, but the Claw Builder uses an OOP
organization both for the GUI and for the code generation. And that did not
really work out well. There is so much boilerplate that has to be
constructed for every new widget type (to declare all of the overriding
routines, to provide basic implementations for those routines, and the like)
that there is a strong dis-incentive to adding new widgets. (The last time I
tried to add a widget, it took over 2 days solid coding to get to a
compilable type.) And the boilerplate didn't seem (for Ada) to make anything
easier to implement or debug.
Similarly, adding a new kind of code generation (something that happens
frequently with the Builder, probably would happen fairly often for a
compiler as well) is a nightmare, as the new dispatching routine has to be
added to every existing widget.
By abandoning traditional OOP, one could do a bit better (especially by
implementing many concrete operations in the root classes -- meaning, in Ada
terms, that they can't be interfaces), and maybe some of the boilerplate
could be reduced - but to do so, you'd have to introduce even more
operations. The number of dispatching operations alone was becoming
daunting.
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).
Randy.
next prev parent reply other threads:[~2017-12-05 20:59 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 [this message]
2017-12-05 22:43 ` Shark8
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