Subject: Re: Testing approaches
From: Erik Naggum <erik@naggum.no>
Date: 2000/03/14
Newsgroups: comp.lang.lisp
Message-ID: <3162005254869991@naggum.no>

* Ray Blaak <blaak@infomatch.com>
| For example, how many kinds of invalid values can you pass to a function?
| A string, an atom, a list, a vector, a float, an integer,... If your
| function was restricted to integers, say, then you could simply
| concentrate on the invalid integer values.

  (check-type <argument> <restricted-type>) takes care of this one for you,
  or you can use assert or throw your own errors if you really have to.  I
  don't see the problem.  writing safe code isn't hard in Common Lisp.

| Static typing is dramatically useful in integration tests.  A unit test
| will not exhaustively exercise other units.  Static typing allows units
| to fit together without the piles of dumb stupid interface errors,
| allowing you to concentrate on the smart stupid logic errors :-).

  when the compiler stores away the type information, this may be true.
  when the programmers have to keep them in sync manually, it is false.

  static typing is like a religion: it has no value outside the community
  of believers.  inside the community of believers, however, it is quite
  impossible to envision a world where static types do not exist, and they
  think in terms that restrict their concept of "type" to that which fits
  the static typing religion.

  to break out of the static typing faith, you have to realize that there
  is nothing conceptually different between an object of type t that holds
  a value you either know or don't know how to deal with, and an object of
  a very narrow type that holds a value you either know or don't know how
  to deal with.  the issue is really programming pragmatics.  static typing
  buys you exactly nothing over dynamic typing when push comes to shove.
  yes, it does buy you something _superficially_, but look beneath it, and
  you find that _nothing_ has actually been gained.  the bugs you found are
  fixed, and the ones you didn't find aren't fixed.  the mistakes you made
  that escaped the testing may differ very slightly in expression, but they
  are still there.  the mistakes you did find may also differ slightly in
  expression, but they are still gone.  what did you gain by believing in
  static typing?  pain and suffering and a grumpy compiler.  what did you
  gain by rejecting this belief and understanding that neither humans nor
  the real world fits the static typing model?  freedom of expression!  of
  course, it comes with a responsibility, but so did the static typing,
  only the dynamic typing responsibility is not to abuse freedom, while the
  static typing responsibility is not to abuse the power of restriction.

  personally, I think this is _actually_ a personality issue.  either you
  want to impose control on your environment and believe in static typing,
  or you want to understand your environment and embrace whatever it is.

#:Erik