comp.lang.ada
 help / color / mirror / Atom feed
From: "Richard  Riehle" <adaworks@earthlink.net>
Subject: Re: Static vs. Dynamic typing (big advantage or not)---WAS: c.programming: OOP and memory management
Date: Thu, 19 Aug 2004 00:37:08 GMT
Date: 2004-08-19T00:37:08+00:00	[thread overview]
Message-ID: <UCSUc.6440$3O3.4141@newsread2.news.pas.earthlink.net> (raw)
In-Reply-To: 3bOUc.46253$US4.14922@trndny01


"Thomas G. Marshall" <tgm2tothe10thpower@replacetextwithnumber.hotmail.com>
wrote in message news:3bOUc.46253$US4.14922@trndny01...
> Richard Riehle <adaworks@earthlink.net> coughed up the following:
> > Please give us an example of a type definition that
> > is difficult to catch and fix.
> >
> > Richard Riehle
>
> I don't understand what you're asking him.  Are you saying that you've
never
> seen a complicated model with a set of types that was ever so slightly
/off/
> the mark so that it was difficult to discover, and also laborious to fix?
>
There are several parts to your question.

    1) Complicated model
    2) Incorrect types ("ever so slightly /off/ the mark
    3) Difficult to discover
    4) Laborious to fix

My experienc iis primarily with Ada, so these questions are not quite
as relevant as they might be in some other language.  Nevertheless,
I will answer them.

I have seen designs where the there were too many types defined.  In
particular, people sometimes design too many floating point types.  For
example,

            package Real_Numbers is
                type Real is digits 8 range -2000.0 .. 2000.0;
                type Degree is digits 6 range 0.0 .. 360.0;
                -- and many more such definitions
           end Real_Numbers;

In the above example, it might be more useful to derived Degree from
Real, or create an Ada subtype (I will not define the difference here, but
it is different) from Real for Degree.   When there are too many variations
on floating point, one often has to do too much type conversion elsewhere
within the program.   However, Ada never lets you get this wrong.

As to incorrect types, this will most often occur in composite types,
especially
record types.  On might forget to include a component of the type in the
definition.  Since record types, in Ada, are most frequently defined as
"limited" types,  they are not part of the public part of a specification.
This makes it quite easy to correct them without disturbing the integrity
of the underlying specification.

As to being difficult to discover, I have not seen this very often in
programming
with Ada.  The language is designed so the compiler will quickly highlight
any
inconsistencies.   The compilation process is not based on textual
information
alone.   Each unit that depends on another unit requires the unit on which
it
depends is successfully compiled first.  The compiler will not even begin to
compile a unit unless its dependency relationships have been resolved.
This
lends itself to rapid discovery of problems with type definitions.

When we consider laborious to fix, I rarely find that to be a problem.  In
fact,
I cannot think of the last time (in nearly 20 years) where the problem with
a type was laborious to fix.   Certainly, when I was a novice there were
problems I could not easily resolve.   With experience, I have found that
well-designed Ada does not entertain me with the kind of mysterious
errors I sometimes encounter in other languages.

I realize that most readers do not benefit fromt the Ada static compilation
model.  Still, that model does have the appeal, to those who do enjoy
it, of making the type system a blessing rather than a nuisance.

Now.  I would still like to see some examples of type problems that
correspond
to the four points in your reply, above.

Richard Riehle





       reply	other threads:[~2004-08-19  0:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1hk5j2d3dlmrp$.153lae83darml$.dlg@40tude.net>
     [not found] ` <40f29222@alpha.wvnet.edu>
     [not found]   ` <104x9d9d53127$.1b8jq22ldf2js.dlg@40tude.net>
     [not found]     ` <40f2ee18@alpha.wvnet.edu>
     [not found]       ` <8yhg4xv40agi.ly9pgul3h7jw$.dlg@40tude.net>
     [not found]         ` <40f3ceee@alpha.wvnet.edu>
     [not found]           ` <19iip59qsl122$.3g3hicltra17.dlg@40tude.net>
     [not found]             ` <40f5bbe1@alpha.wvnet.edu>
     [not found]               ` <lLCdnT5s5oBR0mvdRVn-vw@nildram.net>
     [not found]                 ` <40f67c13@alpha.wvnet.edu>
     [not found]                   ` <b46dnTyZeOwARmrdRVn-sA@nildram.net>
     [not found]                     ` <nisfh0hq8n83kckuss0g2m8dclchbb87c4@4ax.com>
     [not found]                       ` <9qTRc.61502$M95.25853@pd7tw1no>
     [not found]                         ` <ce7ef1c8.0408100846.7cd312e8@posting.google.com>
     [not found]                           ` <BuASc.81568$gE.9811@pd7tw3no>
     [not found]                             ` <411C5D2F.5070408@acm.org>
     [not found]                               ` <BZxTc.103385$M95.61358@pd7tw1no>
     [not found]                                 ` <ifGTc.574$SR4.140@newssvr14.news.prodigy.com>
     [not found]                                   ` <bkiuh054vd4suvd2fgqmekvt9llaend5n1@4ax.com>
     [not found]                                     ` <tNydnW_KyNuXHL3cRVn-oQ@nildram.net>
     [not found]                                       ` <nu2dnc4HfY-2Wb_cRVn-sQ@fcc.net>
     [not found]                                         ` <sgDUc.26532$9Y6.17585@newsread1.news.pas.earthlink.net>
     [not found]                                           ` <3bOUc.46253$US4.14922@trndny01>
2004-08-19  0:37                                             ` Richard  Riehle [this message]
2004-08-19  4:54                                               ` Static vs. Dynamic typing (big advantage or not)---WAS: c.programming: OOP and memory management Thomas G. Marshall
2004-08-19  8:10                                                 ` Dmitry A. Kazakov
2004-08-19 16:24                                                   ` Thomas G. Marshall
2004-08-19 12:52                                                 ` Jim Rogers
2004-08-19 16:31                                                   ` Thomas G. Marshall
2004-08-20  1:27                                                 ` Stephen Leake
2004-08-20  7:00                                                 ` Richard  Riehle
     [not found]                                   ` <TgfUc.122489$M95.15934@pd7tw1no>
     [not found]                                     ` <XtOUc.4483$QJ3.4254@newssvr21.news.prodigy.com>
2004-08-19  0:39                                       ` Richard  Riehle
replies disabled

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