comp.lang.ada
 help / color / mirror / Atom feed
* Re: A note on Ada subtyping
  1999-02-22  0:00 A note on Ada subtyping mike
@ 1999-02-22  0:00 ` Mike Silva
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Silva @ 1999-02-22  0:00 UTC (permalink / raw)



mike@zin.world.com wrote in message <7asf3h$9gm@drn.newsguy.com>...
<...>
>This is an excelllent language. By using variables with restricted
>ranges and values, as in this case, Ada helped me find a prblem in
>my logic!
<...>
>Makes me wonder, why isn't the whole world programming in Ada?


My experience is much the same as yours.  Ada always seems to have excellent
ways to represent the small (for now...) problems I attempt.  It's been
quite a revelation for this long-time programmer, who now goes home from his
programming job and programs for *fun* again.  I also just found this
article:

http://wuarchive.wustl.edu/languages/ada/ajpo/docs/reports/lawlis/5.htm#t2

which, along with the other advocacy info I've read, just reinforces your
question (and many Ada programmers' frustrations, I imagine).

Mike Silva







^ permalink raw reply	[flat|nested] 2+ messages in thread

* A note on Ada subtyping
@ 1999-02-22  0:00 mike
  1999-02-22  0:00 ` Mike Silva
  0 siblings, 1 reply; 2+ messages in thread
From: mike @ 1999-02-22  0:00 UTC (permalink / raw)



As I am learning Ada (I use the GNAT compiler, an
excellent compiler btw), I am more impressed with it.

This is one simple example, where Ada helped me find a bug
in my logic that I would not been able to find as easily
if I was using C or C++ or even Java.

I needed a variable, that logically could not take in values
over some range, say n..m, becuase this is the nature of
the problem was. So I defined this variable to be
of of this type. (where in C/C++/Java, I would simply have
made it an 'int' or a 'short' as almost eveyone else would have),
giving the variable a much larger range that is really needed.

During running of the program, the Ada run-time generated a 
contraint error exception as soon the program tried to
assign a value to this variable outside this range.

This quickly lead me to see where my logic error was, and I fixed
it.

This is an excelllent language. By using variables with restricted
ranges and values, as in this case, Ada helped me find a prblem in
my logic!

Ada is giving me the power to write a more tight code thanks
to the ability to easily define types as required by the 
problem domain.

I know in the other languages, I would have missed this 
logic error, or at least it would have taken longer to find it.

Makes me wonder, why isn't the whole world programming in Ada?

Mike.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-02-22  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-22  0:00 A note on Ada subtyping mike
1999-02-22  0:00 ` Mike Silva

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