🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3004

Re: Dynamic typing (part 3)

#3004
From: David Gudeman
Date: Fri, 15 Mar 1991 20:54
102 lines
5470 bytes
In article  <26221:Mar1510:17:4991@kramden.acf.nyu.edu> Dan Bernstein writes:
]In article <651@optima.cs.arizona.edu> gudeman@cs.arizona.edu (David Gudeman) writes:
]> The point is the essential arbitrariness of type declarations.  There
]> is no good verification-based reason to ...
]
]So? If you want to distinguish between the naturals with and without
]zero, use Ada.

The point is the essential arbitrariness of type declarations.  That
means the point is not (1) that I want to distinguish between the
naturals with and without reals, and not (2) that I want to eliminate
type declarations alltogether.  Just that arguments that type
declarations are necessary for security are problematic if for no
other reason than because they are taking a system designed for A and
claiming that it's purpose is B (where A is efficiency and B is
security).

As I said before, I believe this is a historical accident.  Weak
typing actually does cause security problems, and when people started
making static typing stronger for program security, they started to
believe that the typing itself gives program security.  This is not
the case.  It was necessary to make static type checking stronger to
overcome the problems that static type checking caused in the first
place -- lack of type security.  Dynamically typed languages never had
this problem.

]> ...  You generally don't build up large
]> type libraries like that with dynamically typed languages.

]Unfortunately, the programming world is full of naturally complex data
]structures.

I did say "generally".  However the point is well taken that built-in
aggregate types can't handle everything, and that you still need
ADT's.  So let me answer the original question in another way:

]> ]   Once you've built up a large type library, the chances that any one
]> ]person has a detailed gestalt of the whole thing is very unlikely.
]> ]Therefore, unless you explicitly restrict the type of a value you
]> ]receive, you can only assume that it's any type.

Yes, that is correct.  You generally have to assume that the inputs to
a function can be any type.  That means that you have to write
explicit type checks in some circumstances.  I will even admit that
writing these explicit checks generally requires more time than
declarations would, since you have to explicitly do something if the
type is wrong (usually exit with an error message).  However, it seems
to me that the places where this is necessary are rare since most
operations on ADT's seem to be generic (on arguments other than the
aggregate itself).  Also, these explicit type checks generally only
have to be written once and never changed, unlike static declarations
that may have to be changed when you upgrade the program.

]> ]   Again, one more time, with feeling, my concern is with large software
]> ]systems.
]> Again, I don't believe that required static typing is in any sense, in
]> any software system, more reliable than dynamic typing.
]
]Fer cryin' out loud, who cares?

That's what this whole argument is about.

]... Just stop
]pestering the people who prefer static typing in the same languages.

Calm down, Dan.  I've already said it 4 or 5 times, but here it is
once more: I am not arguing against type declarations.  I am arguing
against _required_ type declarations and against the argument that
static type checking increases program security.  I am not arguing
that static typing has no uses at all, in fact I have said several
times that it is important for efficiency.  I've also mentioned once
or twice that as an option it can make debugging easier.  The only
people who should feel pestered by me are people who think that static
typing is necessary for program robustness and who think that
programmers should be forced by the language to do things in a certain
way.

]> On the contrary, that's where the advantages of dynamically typed
]> languages really shine.  The programs are much more maintainable and
]> "evolvable".
]
]This smacks of religion. Have you compared dynamically typed and
]statically typed programs solving similar problems? Have you observed
]the programs over their useful life and seen how much programmer effort
]went into them?

I haven't done anything resembling an experiment, no.  My opinions are
based on experience and observation (of several large systems).

These things seem rather self evident if you accept the premise that
the amount of work needed to maintain and upgrade a program is roughly
related to the size of the program and to the number of places where a
given piece of information has to be duplicated.  Programs in
dynamically typed languages are generally half to a tenth the size of
programs in statically typed languages that do the same thing.  Also,
many statically typed languages require duplicate type information in
two different places (a declaration and a definition), but dynamically
typed languages have no similar maintenance problem.
--
					David Gudeman
gudeman@cs.arizona.edu
noao!arizona!gudeman
Technical Details
Message-ID: <693@optima.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!orion.oac.uci.edu!cerritos.edu!arizona.edu!arizona!gudeman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!orion.oac.uci.edu!cerritos.edu!arizona.edu!arizona!gudeman
From: gudeman@cs.arizona.edu (David Gudeman)
Newsgroups: comp.lang.misc
Subject: Re: Dynamic typing (part 3)
Message-ID: <693@optima.cs.arizona.edu>
Date: 15 Mar 91 20:54:58 GMT
Sender: news@cs.arizona.edu
Lines: 102