[comp.lang.ada] Review of meridian's $149 Mac Compiler

abdlm@dftsrv.gsfc.nasa.gov (03/28/91)

                       Review of Meridian Software Systems'
                                Macintosh Ada Compiler

Some background: I am a Mechanical Engineer working in NASA's Goddard Space
Flight Center Robotics Branch.  This review is being written for two news
groups: COMP.LANG.ADA & COMP.MAC.PROGRAMMER.  Please excuse the extranious
stuff aimed at the other group, but it might be educational.  I don't write
compiler reviews for a living, therefore I won't make a life's work out of
this.

The majority of my recent programming experience has been in VAX-VMS self
hosted and the 80386 cross targeted embedded area.  The 80386's (3 of them)
control a Robotics Research Corporation 1607HP robot.  The development
environment I use is DEC's Language Sensitive Editor (LSE) which has been
customized by my co-worker Stephe Leake who was also responsible for my Ada
Training.  The customizations to LSE include 5000 lines of TPU (DEC's text
processing utility) and LSE command language.  For those of you who are
unfamiliar with the potential power of LSE, here is a partial list of what it
can do; automatic expansion of language specific templates, automatic batch
launching for compilation, linking and build files, case correction with two
key sequences, extensive punctuation matching facilities, interpretation of
compilation error files for guidance to error locations, and an interface to
the Ada library to facilitate closure compilations.  This editor is hosted on
a VAX 8830 (3 vax processors rated at approx 17 vax mips each) and displays
on a remote 19" Vax station tube running a 132X40 character terminal
emulator.  I am currently limited to 60 open files and five sub-processes
with my  privileges which seem to be adequate.  The net effect of this setup
is that it took six months to master but it does compile Ada code at line per
second rates approach in Think C on a plain Mac with about 4 times the screen
space, and empowers me with a considerable array of code development tools
(ie I'm spoiled).

The basics.  The Meridian Ada compiler is sold to run on any 1 Meg 68000 mac
or better.  My Mac SE had 2.5 M and compiled all of the supplied examples
with Multi-Finder off and a Ram cashe of 720K (I forgot to turn it down after
installing).  The third pass of the compiler balked and I got the "dread
bulldozer" (MPW's name for it) cursor when I had Multi-Finder on and 32k of
Ram Cashe. This seems like a problem that $80 worth of RAM would cure.  All
three of the supplied mac specific examples wouldn't run on my SE (examples
that won't run do awesome things for my confidence in a compiler) Two were
kind enough to emit sysbeeps before exiting to MPW, the third just bombed my
mac smooth as silk.  I later ran all three on a Mac II.  Upon examination of
the source, they all used color quickdraw calls,with the two beeping examples
being kind enough to look for color before using it.  I converted one example
to SE compatibility with small effort and it seemed to run perfectly (but not
colorfully).

All in all, the compiler and the bundled MPW shell ate an easy 1/4 of my 40M
hard drive (ouch!).  The installation was klunky with three separate sets of
contradictory installation instructions located at separate places in the
manual.  The basic bent of the installation was to load MPW first with the
provided installation shell (apple hasn't figured out that lots of people
like to put *all* of their application folders in a folder called
APPLICATIONS and not on the root directory).  The Meridian system also
installed the same way with it's folder "Ada" on the root level of my hard
drive.  I didn't feel like fighting the establishment quite yet so I left all
of the folders where they were.  The installation script somehow missed
putting the proper initialization stuff in the setup or usersetup file for
MPW so I had to do that.  This is definitely *NOT* a first time computer user
product. I'm used to fiddling with my LOGIN and .COM files on my VAX every
day, but not everyone can be expected to understand the idea of environment
variables from the getgo.

(I bet the Mac programmers are still wondering why I use Ada on the MAC)

How does Meridian rate as an Ada Compiler? Well it's validated so that's
something. (lots more than can be said for any "C" or C++ compiler).  It can
generate both double-clickable applications, deskaccesories and MPW tools
(which is what the compiler is).  Some "useful" IO packages are provided by
Meridian.  All text_IO, sequential and direct IO operations are supported but
because these concepts are not parts of "standard" Mac applications, they
would seem somewhat klunky in mac applications.  Generics are expanded as
macros so units which instantiate generics are dependant on the bodies of
generics (typical for many compilers).  You are provided with your choice of
preemptive or non-preemptive tasking and time-slicing.  However tasks keep
their stacks in the program heap so quickdraw won't work properly unless the
task switches it's stack back to the application stack (no explanation on how
to do this in manual).  Global and local optimizers are provided but Meridian
places emphasis on turning off checks to optimize performance (ACK!).  The
library is kind of goofy because the compiler requires the library to be in
the current working directory (I bet you didn't know the Mac had such a
concept.)  A debugger is provided (that's how I found the color quickdraw
calls were bombing my system) In general it pales in comparison to the Think
C window based spiffy debugger but then again we write in Ada so we **don't
have bugs!!!!*** More on this later.  Meridian supports pragma INTERFACE to
all of the other Apple MPW languages.  If you want to interface to some other
language like FORTRAN (BAAAARRRRFFFF!!!) just look at the object code
(Meridian's recommendation).  Machine Insertion is also provided for but only
in the form of raw hex code (an enterprising programmer could develop a
package with the named number equivalents of the actual M68000 op codes).
Text_Handler from chapter 7 of the LRM is also provided.  Math, bit op and
command line argument packages are also provided.  Address, Enumeration,
Length and Record representation clauses are given good treatment and have
reasonable restrictions (variant records have extra data to help the
processor sort things out).  Source lines and identifiers are limited to 200
characters (I can live with that).  From my experience, my advice is to think
REAL HARD about the need to interface with another language, Ada is an
EXTREMELY flexible and powerful language, there's probably a way to do what
you need in Ada with some elegence.  By the time I've figured out what a
FORTRAN routine REALY does I could have written and debugged what I REALY
wanted in Ada.

I didn't get a chance to run any real benchmarks but the provided examples
"appeared" to run at speeds approaching the limitations of quickdraw calls.
These were definitely *NOT* a full test.  It is important to know more about
exception propagation times, the effects of constraint checking, case
processing, numerical (SANE is used), and sub_program call overhead to give a
full report.

A full set of interface libraries are provided to interface with Mac OS and
the toolbox. They provide all of the functionality of Think and MPW libraries
but they are as ugly as a mud fence.  My bitch list on the style and design
of the interface packages would hog lots of the net's bandwidth.  I intend to
do some work on repackaging these to make them look like real Ada instead of
converted Pascal.  There is great wisdom in the inclusion of representation
clauses for records, enumerals and addresses in the LRM, Meridian should have
taken advantage of it.  If I would tried some of the hacks I saw in the
quickdraw package I would have been laughed out of the code review (you know,
the code reviews where they put plastic on the floor to keep the blood off of
the carpet).  The Macintosh presents many challenges to the interface writer,
there are few systems where so many system calls take so many types, pointers
to types and handles to types in such a confusing manner as the Mac.  In
cases where the toolbox offer access to possibly absent hardware and ROM
routines it would be advisable to force the user to call an initialization
sub_program to check for the existence of the desired device of routine
family at startup and raise the proper exception to indicate impending doom.
The same can be said for NewHandle and NewPtr, many Mac programmers I know
can now write the short piece of code that checks for NULL values from
functions in their sleep, unfortunately they sometimes forget to do it when
awake and pay the price dearly during beta testing.  This case is a wonderful
place to use exceptions to reduce code size and complexity.

To be honest I wouldn't want to learn Ada and Macintosh programming at the
same time, especially with this product.  Yes, MPW is is far more powerful
than Think C, but with power comes complexity and confusion.  I would prefer
a stand alone development environment and I'm sure MPW could be customized to
act like one for Ada but that would take a MPW guru months to do.  I'm also
sure Meridian has its programming dungeon furiously working on just such a
thing, but I've already spent my $200 (I bought the very necessary MPW
manuals too).  To Meridian's credit, they have brought one of the most
portable languages in the world today, to one of the most difficult to
program computers in the world today.  They have also done so at a price with
one less significant digit than their competition.  For three more Days.

There are some things about the MPW-Meridian combination I can't live with.
I'm hooked on LSE, there are a lot of things I can get along without but
there a few which are absolutely necessary when editing high Level Languages:

1.  Capitalization macros. Cntl/w fixes capitalization to my site's
identifier/sub_program name style: BASE_JACOBIAN or joint_PoSiTioN would be
converted to Base_Jacobian and Joint_Position. Even though Ada isn't case
sensitive it helps a *lot* when reading those 700 line source code files).
gold/cntl/w goes all caps for types and enumerals gold/q goes all_lower_case
for ada reserved words. (OF COURSE RESERVED WORDS ARE LOWER CASE!!!) of
course Meridian got all of theirs backwards in their library specs.

2.  Automatic comment continuation.  The editor automatically wraps at 80
columns (like a Mac) and puts comment (--) marks at the same column as the
previous lines comment marks.

3.  Template expansion (cntl/e).  With the combination of slow compiler speed
and fledgling Ada programmers lots of syntax error are the order of the day. I
tried to avoid syntax errors when changing the examples but managed use some
unknown identifiers (filloval not drawoval) waiting 5 minutes to have the
compiler tell you you can't type is a pain in the ass. (at least it doesn't stop
at the first error like Think C though) At our lab we try to tell the novice
programmers not to tough anything but cntl/e and the cursor keys until the
editor says "type!". A good Ada programmer (7 years experience and can quote the
LRM chapter and verse) can sometimes get away without using cntl/e *much* but
I've seen novices try to freehand their first try and then spend two days
sorting out the mess.  Non library updating compiles don't seem to be much
faster if all you want is syntax checking.

4.  One key compilation/linking/closure/error-review.  Instead of leaving the
editor or switching windows to type the proper command to execute the
compiler. My environment interprets F17 (everyone has 20 functions keys,
Right?) as "save all open *.ada buffers, submit the current buffer to the ada
compiler as background batch, put the *.err file in the login directory, beep
when your done and show me a synopsis of the status" F18 is "open the error
file as a temp buffer and place the cursor on the first error message" when
in this mode there are lots of spiff keys for relating errors to their source
code.  Meridian has a similar ability to take it's compiler error filer and
generate MPW commands to take the programmer to the offending line but
doesn't work quite as advertised, but can be made to work even better with a
script that automatically does window and file arranging for you if the
compiler returns an error status. Think C has these features and even some
more like project maintenance.

The truth is that most of my derogatory comments could really be aimed at the
MPW editor/shell interface which is extensible (I heard a variant of GNU emacs
around for it).  This might be the time and place to suggest some measure of
cooperation amongst the Mac/Ada community with regards to editor extensions,
toolbox packages etc for use by this community.  You can't just plop down behind
your mac and start cranking code like Think C.  I could envision a day though,
when a proper approach to packaging the toolbox interface could give the Ada
programmer a leg up because of the added error checking an interface could help
provide.  It would also be interesting to see how fast this product runs on
faster (ci-fx) Macs.


To sum up.
1.  ***AWESOME*** price for an Ada compiler.
2.  Above average doccumentation relative to other Ada products.
3.  MPW environment is iritating to learn but probably a powerful tool to use in the
    long run.
4.  Complete but klunky interface to toolbox and MacOS routines and globals.
5.  Not my first choice for learning Mac programming
6   compile time is slow relative to Think C but faster than Think C using
    objects.

*****************************************************************
                            Remember
*****************************************************************
Meridian's sale on this compiler ends Match 31,
They *do* take credit cards
$149 for compiler and MPW
$50 for MPW manuals -(realy helpful)
$10 shipping charge

phone#
800-221-2522
or
714-727-0700

They're serious about the March 31 deadline. Meridian had the same deal for
their pc compiler and it ended Feb. 28 and the price went up to $499


Dana Miller
ABDLM@ROBOTS.SPAN.GOV.NASA

(301) 286-5424

All opinions are my own and do not reflect the policies of my employer.