comp.lang.ada
 help / color / mirror / Atom feed
From: Frank Pappas <0004238973@mcimail.com>
Subject: Re: Classic-Ada
Date: Wed, 17 Jul 91 14:08 GMT	[thread overview]
Message-ID: <71910717140817/0004238973NC5EM@mcimail.com> (raw)

  A recent posting asked for information about Classic-Ada. Here's
the contact information:

              Software Productivity Solutions
              (407) 984-3370

I reviewed the product in the November 1990 issue of IEEE's Computer.
I liked the product then and I know that they were making
improvements at the time. The only thing I disliked about it was the
documentation, which was pretty bad (but not impossible to use).
Again, I'm sure they have improved it by now.

  Coincidentally, someone called me last week asking how to convert
C++ source to Ada source.  His company had C++ source that it wanted
to rewrite in Ada. (I didn't ask why). I suggested that the best
approach was to redesign the code in Ada, but if that wasn't
feasible, he should look at Classic-Ada.

  Classic-Ada provides OOP extensions to Ada, with full Ada still
available. The Classic-Ada preprocessor accepts Classic-Ada source
and produces pure Ada source. The preprocessed source must then be
compiled with an Ada compiler. Classic-Ada also generates an
``executive'' (which takes care of dynamic binding) that must be
compiled with the pure Ada source.

  I reviewed Classic-Ada under 386 Unix. Looking at the pure Ada
generated by the preprocessor, it seems that you could use
Classic-Ada under Unix to write ``objected-oriented Ada'', produce
the pure Ada, and then compile the pure Ada, including the
``executive'', under MSDOS, VMS, etc. Of course, that assumes you
don't program in any Unix dependencies.

  At the time I reviewed Classic-Ada, the preprocessor performed
syntactic and semantic checking of the Classic-Ada extensions only.
Checking of standard Ada features was left to the target compiler.
That's not the most productive way to compile, and there's some
obvious potential awkwardness, but it didn't seem to be that
troublesome. As for consistency of class interfaces, Classic-Ada has
a program library similar in use to an Ada program library.

  Before giving an example of Classic-Ada source, a couple points
about the Classic-Ada extensions and their mapping to pure Ada.
Classes are mapped to packages and methods to subprograms. As already
mentioned, dynamic binding is handled by an ``executive''.

  The following example comes from the Computer review, which is
based on an example from their manuals. If you want details about it
look at the review. Also, I seem to recall that the company includes
an article or two on Classic-Ada with their sales information.

  If anyone from Software Productivity Solutions sees this posting,
let us know if any significant errors exist in the example or in the
posting itself. If any other vendors have OOP front-ends for Ada,
please let me know about your product by sending e-mail directly
to me. 


      -- A class specification in Classic-Ada --


WITH Tactical_Type; USE Tactical_Types;
CLASS Radar IS

  SUPERCLASS Fixed_Object;

  METHOD Create (New_Radar : OUT Object_ID);

  INSTANCE METHOD In_Range (Penetrator : Object_ID);
  INSTANCE METHOD Transmit_Message (Message : String; Penetrator : Object_ID);
  INSTANCE METHOD Out_Of_Range (Penetrator : Object_ID);

  INSTANCE METHOD Initialize;

END Radar;

      -- An example of inheritance in Classic-Ada --

CLASS Sam IS

  SUPERCLASS Radar;

  METHOD Create (New_Sam: OUT Object_ID);

  INSTANCE METHOD Add_Penetrator    (A_Penetrator    : Object_ID);
  INSTANCE METHOD Remove_Penetrator (A_Penetrator    : Object_ID);
  INSTANCE METHOD Expect            (This_Penetrator : Object_ID);

  INSTANCE METHOD Initialize;

END Sam;

WITH Tactical_Types;  USE Tactical_Type;
WITH Penetrator_List; USE Penetrator_List;
CLASS BODY Sam IS

  Max_Shots             : INSTANCE Integer;
  Possible_Penetrators  : INSTANCE Fighter_List;
  Alert_Delay           : INSTANCE Integer;

  METHOD Create (New_Sam : OUT Object_ID) IS
  BEGIN
    New_Sam := INSTANTIATE;
    SEND (New_Sam, Initialize);
  END Create;


  INSTANCE METHOD Add_Penetrator (A_Penetrator : Object_ID) IS
  BEGIN
    Add_To_List (A_Penetrator, Possible_Penetrators);
  END Add_Penetrator;


  INSTANCE METHOD Remove_Penetrator (A_Penetrator : Object_ID) IS
  BEGIN
    Remove_From_List (A_Penetrator, Possible_Penetrators);
  END Remove_Penetrator;


  INSTANCE METHOD Expect (This_Penetrator : Object_ID) IS
  BEGIN
    Status := Alert;
    SEND (SELF, Add_Penetrator, A_Penetrator => This_Penetrator);
  END Expect;


  INSTANCE METHOD Initialize IS
  BEGIN
    Max_Shots := 4;
    Possible_Penetrators := null;
    Alert_Delay := 10;
    SEND (SUPER, Initialize);
  END Initialize;

END Sam;


====================================================================
INTERNET: fpappas@mcimail.com                  PHONE: (215) 789-3206
====================================================================

             reply	other threads:[~1991-07-17 14:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-07-17 14:08 Frank Pappas [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-07-18 15:22 Classic-Ada Bud Bach
replies disabled

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