[comp.lang.misc] Dynamic typing, part 4

rockwell@socrates.umd.edu (Raul Rockwell) (04/30/91)

Thomas Breuel:
>   ;;; Scheme
>   (define (fermat-conjecture-is-true?) ...)
>   (define (f) (if (fermat-conjecture-is-true?) 9 #f))
>   (define (g) (+ (f) 1))
>   (g)

As TMB points out, it is quite easy to forbid such programs based on
static analysis (if you wish).  It may be that scheme currently lacks
the tools to do this, but scheme is peculiarly suited for _writing_
such tools.

> Static typing is added functionality in the compiler.

Or in a lint-like program used independentally of the compiler.

   [ .. these may occur in code used very rarely .. ]
> Trivial type errors like this occur even in well-written programs, and
> cannot be caught by many well-designed dynamically typed languages
> (like Scheme) at compile time.

(1) the advantage of an interpreted language like Scheme is that you
can test code that is called rarely.  Scheme also allows you to easily
build "test-beds" for independantally testing sections of a large
program.

(2) a dynamically typed language should allow you to _reduce_ the
number of tests and branches in your programs, compared to the same
program written in a statically typed language.

Raul Rockwell