🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2936

Re: Runtime Polymorphism -- To Have and Have Not

#2936
From: David Gudeman
Date: Mon, 11 Mar 1991 03:20
59 lines
2980 bytes
In article  <2773@enea.se> Erland Sommarskog writes:
]
]But do you make less type errors? And when do you find them?

Yes, I make fewer type errors.  Most type errors in statically typed
languages are not really errors in logic, they are errors in assuming
the language is smart enough to make obvious conversions.  Smarter
languages just do the right thing.

I find type errors in the same amount of time it takes me to find
other blatant runtime errors.

]I spend quite some time of declaring stuff and setting up
]the types. And when I have done this I also know a lot more
]what I am about to do.

I prefer to spend the time writing experimental code.  After you have
decided how to organize your data, the vast majority of time spent in
declarations is trivial stuff that can (and should) be done by the
computer.

]What do you mean? OK, in Ada you have to write
]
]    PACKAGE Integer_list IS NEW Linked_list(integer);
]    PACKAGE Array_list IS NEW Linked_list(Array_type);

]and then declare each list you need. But you don't have to rewrite
]the list package for any type that you might think of.

You aren't getting the same functionality that dynamic typing gives.
To get that functionality you would have to declare a tagged union of
every type in the program, and for each list function that deals with
list values you have to do the right thing with the member of the list
depending on it's actual type.  To compare two values you have to
write code to check the type and do the right thing based on the type.
You have to (in general) write seperate code for every type that is
used in the program.

]1) People pay me to program. The earlier I find my errors, the
]   less it costs my contractor.

Suppose you spend 2 hours writing type declarations and 2 hours
writing code.  A single compile finds your type errors.  I'll spend no
time writing declarations and 2 hours writing code (probably less
since dynamic typed languages have such powerful built-in data types).
I'll find the type error, on the average, after 10 to 20 minutes of
testing.  Who has saved more money for his contractor?

Of course these numbers are just taken out of thin air.  The point is
that programming is _faster_ with dynamic polymorphism, so it makes no
sense to complain that it will cost more money looking for blatant
errors.  Type errors are a trivial concern that get blown way out of
proportion by people who are used to statically typed languages and
are looking for justifications not to learn and use better
technologies.
--
					David Gudeman
gudeman@cs.arizona.edu
noao!arizona!gudeman
Technical Details
Message-ID: <595@optima.cs.arizona.edu>
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!arizona!gudeman

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!arizona!gudeman
From: gudeman@cs.arizona.edu (David Gudeman)
Newsgroups: comp.lang.misc
Subject: Re: Runtime Polymorphism -- To Have and Have Not
Message-ID: <595@optima.cs.arizona.edu>
Date: 11 Mar 91 03:20:36 GMT
Sender: news@cs.arizona.edu
Lines: 59