comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin D. Condic" <mcondic-nospam@quadruscorp.com>
Subject: Re: Disallowing Pre-Defined Operations
Date: 2000/04/06
Date: 2000-04-06T21:53:58+00:00	[thread overview]
Message-ID: <38ED3145.BE3CEC68@quadruscorp.com> (raw)
In-Reply-To: 8cic1h$195$1@nnrp1.deja.com

Robert Dewar wrote:
> Why does this need a language feature? This is the sort of thing
> that is perfectly easy to program in Ada now. Sure you might
> get a little bit more efficient implementation if it was built
> in, but compilers could already do that by use of Intrinsic
> conventions, I see no reason for a new language feature here.
> 
In my experience, while one could certainly write source level code to
do the job, this ends up sufficiently inefficient to be not useful in
the kinds of systems that need it most - real time control computers.
You could degenerate to programming it in assembler, but often this gets
clumsy. (typically, you want to do something to trap overflow interrupts
and this can be difficult or problematic if you are not the compiler.
Either that, or you're working with sub-ranges of the word size and you
want a trap similar to Constraint_Error which gets problematic when
you've got lots of sub-ranges.) A solution does exist because I've done
it, but it would be easier - and may have other efficiency & error
checking benefits - if there were direct compiler support for it as an
intrinsic type.

Certainly, it would be easier for your average fresh-out or
inexperienced user to take advantage of it if it were intrinsic. And you
never quite know what sort of uses something like this might get put to
if it was simply right there to use.

> Does anyone have any experience with saturating numeric types
> in existing Ada programs?
> 
Yup. In Ada83 at least. Its not real pretty. Havn't had to do it in
Ada95 yet. Day ain't over, yet! :-)

If its too hard to implement or you just don't think it has enough
interest for ACT to support it, by all means drop the idea on the floor.
The original question was basically "What new features would it benefit
Ada to have?" I don't know about the rest of the world but if Ada had
saturated math data types *I* would have beaten it to death in the
engine control business. I'd suspect that other embedded programmers
would find the feature *very* useful and (here's the good part!) it
doesn't exist (that I am aware of) in the more popular languages for
that market sector. (Product distinction?)

It doesn't sound to me like something that would require some massive
compiler rewrite or some fundamental change in Ada syntax or semantics.
I'm no expert, but it seems fairly small and self-contained such that a
compiler could provide it as an option that could be toggled by
switches. Syntax? Maybe "type T is saturated digits 6 ;" or "type T is
saturated range -128..127 ;" Maybe as a pragma? "pragma Saturate (T) ;"
I personally wouldn't be fussy. :-)

MDC
-- 
=============================================================
Marin David Condic   - Quadrus Corporation -   1.800.555.3393
1015-116 Atlantic Boulevard, Atlantic Beach, FL 32233
http://www.quadruscorp.com/
m c o n d i c @ q u a d r u s c o r p . c o m

***PLEASE REMOVE THE "-NOSPAM" PART OF MY RETURN ADDRESS***

Visit my web site at:  http://www.mcondic.com/

"Because that's where they keep the money."
    --  Willie Sutton when asked why he robbed banks. 
=============================================================




  reply	other threads:[~2000-04-06  0:00 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-10  0:00 Disallowing Pre-Defined Operations Charles H. Sampson
2000-03-09  0:00 ` Keith Thompson
2000-03-09  0:00 ` Samuel T. Harris
2000-03-12  0:00   ` Steven Hovater
2000-03-10  0:00 ` mark_biggar
2000-03-10  0:00 ` Jean-Pierre Rosen
2000-03-11  0:00   ` Tarjei Tj�stheim Jensen
2000-03-11  0:00     ` James S. Rogers
2000-03-13  0:00       ` Tarjei T. Jensen
2000-03-13  0:00     ` Robert Dewar
2000-03-13  0:00       ` Keith Thompson
2000-03-15  0:00         ` Robert Dewar
2000-03-13  0:00     ` dmitry6243
2000-03-15  0:00     ` Charles H. Sampson
2000-03-15  0:00       ` Robert Dewar
2000-03-21  0:00         ` Charles H. Sampson
2000-03-21  0:00           ` Robert A Duff
2000-03-21  0:00           ` Robert Dewar
2000-03-12  0:00   ` claveman
2000-03-12  0:00     ` Robert A Duff
2000-03-13  0:00       ` Tarjei T. Jensen
2000-03-13  0:00         ` Robert Dewar
2000-03-13  0:00         ` Robert A Duff
2000-03-15  0:00       ` Charles H. Sampson
2000-03-15  0:00         ` Tucker Taft
2000-03-15  0:00           ` Paul Graham
2000-03-16  0:00             ` Robert Dewar
2000-03-16  0:00             ` Charles Hixson
2000-03-17  0:00               ` Paul Graham
2000-03-17  0:00                 ` Charles Hixson
2000-03-18  0:00                   ` Robert Dewar
2000-03-20  0:00                     ` Charles Hixson
2000-03-20  0:00                       ` Robert Dewar
2000-03-16  0:00           ` Bryce Bardin
2000-03-16  0:00           ` Tarjei T. Jensen
2000-03-16  0:00             ` Dale Stanbrough
2000-03-16  0:00             ` mark_biggar
2000-03-17  0:00         ` Robert A Duff
2000-03-13  0:00     ` Ted Dennison
2000-03-14  0:00 ` Nick Roberts
2000-03-15  0:00   ` Robert Dewar
2000-03-17  0:00 ` William A Whitaker
2000-03-18  0:00   ` Robert Dewar
2000-03-18  0:00   ` Robert Dewar
2000-03-18  0:00   ` Robert Dewar
2000-03-22  0:00     ` William A Whitaker
2000-03-23  0:00       ` Robert Dewar
2000-04-06  0:00         ` Robert I. Eachus
2000-04-05  0:00           ` Marin D. Condic
2000-04-06  0:00             ` Robert Dewar
2000-04-06  0:00               ` Marin D. Condic [this message]
2000-04-07  0:00                 ` dale
2000-04-07  0:00                   ` Marin D. Condic
2000-04-07  0:00                     ` Tarjei T. Jensen
2000-04-07  0:00                       ` Marin D. Condic
2000-04-07  0:00                         ` tmoran
2000-04-07  0:00                           ` Marin D. Condic
2000-04-08  0:00                             ` Vladimir Olensky
2000-04-08  0:00                             ` Vladimir Olensky
2000-04-08  0:00                         ` Dale Stanbrough
2000-04-10  0:00                         ` Tarjei T. Jensen
2000-04-15  0:00                         ` Niklas Holsti
2000-04-15  0:00                           ` Marin D. Condic
2000-04-07  0:00                 ` Robert Dewar
2000-04-07  0:00                   ` Marin D. Condic
2000-04-09  0:00               ` Robert I. Eachus
replies disabled

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