comp.lang.ada
 help / color / mirror / Atom feed
From: Loren@cup.portal.com (Loren Louis Hart)
Subject: Re: if UNIX then USE_C ?? (was: Reasons for drop)
Date: 23 Feb 90 19:34:22 GMT	[thread overview]
Message-ID: <27257@cup.portal.com> (raw)
In-Reply-To: 34196@news.Think.COM

In an article posted by barmar@think.com on this topic
>In article <5476@crdgw1.crd.ge.com> oconnordm@CRD.GE.COM (Dennis M. O'Connor) 
w
>rites:
>>mike@cs (Mike Coffin) writes:
>>] but the operating system itself is optimized for running C programs.
>>If we allow that UNIX is optimized for anything ;-), just what
>>are these C-specific optimizations that favor C and C++ over Ada ?
>
>The most obvious way in which a particular OS is oriented towards a
>particular language is when it comes to data being passed between
>application programs and OS routines.  Unix kernel routines and system
>library routines expect things like null-terminated strings and structures
>laid out the way that system's C compiler lays them.  Programs written in
>other languages often need to transform data when passing it into and out
>of the OS.

I would say that things like null terminators and other system representations
are implementation issues of the compiler, particularly with respect to Ada.
Having written the Unix system interface for an Ada database, I would have
to say that the Verdix compiler's implementation is superior.  Ada allows for
the implementation to deal with terminating strings and other such platform
specific issues.  I found that the Verdix Ada compiler provided all the 
necessary capabilites to write an effective, reliable, and efficient Unix
Interface.

>Another area of language bias is documentation.  Unix manual pages for
>subroutines generally describe the invocation mechanism and argument types
>in C syntax.

In our case it was helpful to know some C to write the OS interface; however
since our project, Verdix has written and provided the text of the Ada package
specifications for many of the unix system calls.  I often find these Ada
package specifications clearer than the unix manuals on issues of types and
parameter passing mechanisms.

>Ada representation clauses may be useful for solving some parts of the
>first problem, but such programs are not portable.  Further, the manual
>pages are written portably, so they don't describe argument representation.
>In order to write the rep spec for a structure being passed to a system
>routine you would have to go through the C compiler documentation and find
>out how it lays out structures (hopefully this is documented).

>These problems aren't as bad so long as programs stick to OS-independent
>libraries, such as stdio for C and the standard packages that Ada provides.
>However, the data transformation overhead is still there, buried inside the
>library implementation.

Again, given the right choice of compiler in a given instance, what little
data transformation overhead is negligable by comparison to the inherent cost
of a system call.

>>Sorry, I disagree. Operating systems provide a "virtual machine"
>>for the applications programs to execute on; compilers provide
>>a "virtual machine" for the programmer to write programs for.

>But there's opportunities to optimize when the two virtual machines have
>similarities.  For instance, both the Unix VM and the C VM share the same
>string abstraction, so it is never necessary to convert C strings to Unix
>strings.

Again with the Verdix implementatio, their strings are null terminated and
there is never a need to convert them.

>>An operating system that is only able to efficiently support one
>>language or one family of languages is an inadequate operating system :

>Unfortunately, many OSes are inadequate.  The Mac OS is Pascal-oriented,
>Unix is C-oriented, Genera (the OS on Symbolics Lisp Machines) is
>Lisp-oriented, Multics is PL/I-oriented, etc.

Again I argue that a proper implementation of an Ada compiler should be in 
line with the platform it runs on.  A platform for a compiler includes not only
the particular CPU, but the OS as well.  I will admit that there are some
special purpose operating systems that make these kinds of adaptations next
to impossible, but I would not put Unix into this category!
--
Loren L. Hart
loren@cup.portal.com
San Jose, California

  reply	other threads:[~1990-02-23 19:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1990-02-20 16:13 Reasons for dropping Ada Ted Holden
1990-02-20 21:04 ` Richard S D'Ippolito
1990-02-20 23:03   ` Reasons for keeping Ada David Kassover
1990-02-21  0:40     ` Clement Pellerin
1990-02-21 19:02   ` Reasons for dropping Ada Loren Louis Hart
1990-02-22 16:07     ` Mike Coffin
1990-02-22 17:01       ` if UNIX then USE_C ?? (was: Reasons for drop) Dennis M. O'Connor
1990-02-22 21:51         ` Barry Margolin
1990-02-23 19:34           ` Loren Louis Hart [this message]
1990-02-25 19:58           ` David Kassover
1990-02-26 12:45             ` John F Nixon
1990-02-26 18:28               ` David Kassover
1990-02-26 20:55                 ` John F Nixon
1990-02-26 22:00                   ` David Kassover
1990-02-27 18:55                 ` Jeremy Epstein
1990-02-28  1:19                   ` Alex Blakemore
1990-02-28 18:56                     ` Ada functions versus arrays (i.e. () vs [] ) Richard A Hammond
1990-03-01  3:25                       ` Alex Blakemore
1990-03-01 13:11                         ` Robert Firth
1990-03-02 10:56                           ` Mike Harrison
1990-03-02 23:46                           ` Scott Simpson
1990-03-02 10:42                         ` Mike Harrison
1990-03-06 19:13                       ` Erland Sommarskog
1990-03-08 14:21                         ` John Goodenough
1990-03-14 18:19                     ` if UNIX then USE_C ?? (was: Reasons for drop) RCAPENER
1990-03-01  0:29                   ` David Kassover
1990-03-01 15:11                     ` Steve Tynor
1990-03-01 18:29                       ` David Kassover
1990-03-02  0:19                 ` Robert D. Houk
1990-02-28 19:51         ` Andy DeFaria
1990-02-20 22:21 ` Reasons for dropping Ada Jeffrey M. Schweiger
replies disabled

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