[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: another take on hackers and painters



From: Michael Vanier <mvanier@cs.caltech.edu>
Subject: Re: another take on hackers and painters
Date: Tue, 20 May 2003 01:20:49 -0700

> 
> I can't say I agree with your views on static typing, although many on this
> list will.  Have you ever used a really *nice* static type system like in
> ocaml or haskell?  They're not perfect, but they're miles ahead of what
> most people think of when they think "static typing".  Here is quicksort in
> haskell:
> 
>     qsort :: [Int] -> Int
>     qsort [] = []
>     qsort (x : xs) = qsort [ y | y <- xs, y <= x ]
>                      ++ [x] ++ qsort [ y | y <- xs, y > x ]
> 
> Beautiful enough for ya? ;-)

Very nice example of static typing! ;-)

See, there is an error. The error is in the type information
_only_. If you did not write type information, all would be correct
(I know that in this case this is not needed in Haskell). Of course,
compiler will catch the error, but in the language with dynamic typing
there could be no such error.


Jakub Travnik
jabber://jtra@jabber.com