comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: Nontrivial examples of C interface with Ada
Date: 2000/05/25
Date: 2000-05-25T00:00:00+00:00	[thread overview]
Message-ID: <o%2X4.118$_M2.45406@news.pacbell.net> (raw)
In-Reply-To: 392CC733.13BDDC84@quadruscorp.com

> > "semi-thick" binding is one that abstracts away typical stupid C
> > artifacts like pointer interfaces, return error codes, and
> > null-termiated strings. That way the interface "feels" like Ada. But it
> > doesn't abstract things so much that the C docs for the routine can't be
> > used for the Ada bindings.
> ...
> However, you at least want to attempt to make it close to the original routine,
  Even though your code now looks Ada-ish and has strong typing, exceptions,
etc. you will still be operating at a very low, C-ish, level of abstraction,
Will you, for instance, use the OS'es semaphore function calls, or use
Ada protected records?  Callbacks via procedure access values, or by overiding
tagged record primitives?  Suppose you want to open a socket connection,
send some html text, and close it.  Do you really want the ugly details
of socket handling, or do you want a procedure Open, procedure Put, and
procedure Close?
  My preference is to start from the point of view of someone about to
design a spec for some abstraction (socket, Windows clipboard or dialog
box, etc).  "How would I do this in Ada?".  Then the body tries to
implement the abstraction using C calls.  Admittedly, sometimes the
simple, clean, abstraction needs some warts added to allow some of the
strange functions, or to fit the restrictions of, the underlying C, but
usually you can make something reasonably clean.  You can't just do a
translation of the C docs, but instead you have something that makes
sense and can be explained, usually, more simply.




  reply	other threads:[~2000-05-25  0:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-23  0:00 Nontrivial examples of C interface with Ada gressett
2000-05-24  0:00 ` David Emery
2000-05-24  0:00 ` tmoran
2000-05-24  0:00 ` Terry Westley
2000-05-24  0:00 ` Ted Dennison
2000-05-24  0:00   ` Marin D. Condic
2000-05-25  0:00     ` tmoran [this message]
2000-05-25  0:00       ` Geoff Bull
2000-05-25  0:00         ` tmoran
2000-05-25  0:00       ` Ted Dennison
2000-05-25  0:00         ` tmoran
2000-05-25  0:00           ` Ted Dennison
2000-05-25  0:00             ` tmoran
2000-05-26  0:00         ` Julian Day
2000-05-26  0:00           ` Julian Day
2000-05-26  0:00       ` Marin D. Condic
2000-05-27  0:00         ` tmoran
2000-05-27  0:00           ` Marin D. Condic
2000-05-28  0:00             ` tmoran
2000-05-28  0:00               ` Marin D. Condic
2000-05-28  0:00                 ` tmoran
2000-05-28  0:00               ` Robert Dewar
2000-05-25  0:00     ` Ted Dennison
2000-05-25  0:00       ` tmoran
2000-05-29  0:00       ` Geoff Bull
2000-05-24  0:00 ` Marin D. Condic
2000-05-24  0:00   ` Scott Ingram
2000-05-24  0:00     ` Marin D. Condic
replies disabled

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