comp.lang.ada
 help / color / mirror / Atom feed
From: vladimir@inteloc.intel.com (Vladimir G. Ivanovic)
Subject: Re: Questions on Ada...
Date: 6 Jul 89 19:02:46 GMT	[thread overview]
Message-ID: <4611@omepd.UUCP> (raw)
In-Reply-To: 979@cbnewsl.ATT.COM

In article <979@cbnewsl.ATT.COM> arny@cbnewsl.ATT.COM (arny.b.engelson) writes:
>There is more than one way to do this.  One alternative is to use overlays.
>Simply declare an integer array of the proper length, use an address clause
>to overlay it at the location occupied by the structure you are copying
>from, and copy it to an integer array overlayed at the destination address.
>Another alternative is to use unchecked conversion from one type to another.
>Again, the Ada purists will be up in arms (overlays are officially erroneous),
>but the concept is very useful in some situations.

I agree about the utility, but disagree about the "officially erroneous"
comment attributed to Ada purists.  In fact, I'd say there are entire classes
of problems that cannot be solved without using Unchecked_Conversion. 

A more understanding approach to strong typing, Ada and program construction
stresses the utility of letting the compiler do as much work for the
programmer as possible.  Heck, I'd buy in a flash a system that allowed me to
specify a problem domain complete with hems and haws and retractions and
contradictions inherent in unstructured human thought.

The problem with using Unchecked_Conversion is that the programmer is saying
to the compiler, "Trust me.  I really do know what I'm doing."   The compiler
can't therefore check for consistency by asking "Does this make sense?" i.e.
by checking types.

Time and time again, experienced Ada programmers say that it takes a fair bit
of time before a person begins to think Ada-think.  In other words, it takes
time (and understanding) before programmers learn to organize their programs
as a collection of objects (data structures with associated methods =
packages) passing messages (procedure calls and rendezvous).  

The original posting asking "How can I translate this <insert favorite
langauge> into Ada?" is a stage all Ada programmers go through.  There is a
better way, and it requires a different mindset.

  reply	other threads:[~1989-07-06 19:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-06-29  3:33 Questions on Ada Krishan M Nainani
1989-07-03 13:51 ` arny.b.engelson
1989-07-06 19:02   ` Vladimir G. Ivanovic [this message]
1989-07-11 19:41     ` arny.b.engelson
1989-07-05 23:42 ` John Rogers
replies disabled

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