What is Expressiveness in a Computer Language [correction]

Andreas Rossberg rossberg at ps.uni-sb.de
Wed Jun 28 11:56:39 CEST 2006


David Hopwood wrote:
>>
>>>(defun blackhole (argument)
>>> (declare (ignore argument))
>>> #'blackhole)

> I believe this example requires recursive types. It can also be expressed
> in a gradual typing system, but possibly only using an unknown ('?') type.
> 
> ISTR that O'Caml at one point (before version 1.06) supported general
> recursive types, although I don't know whether it would have supported
> this particular example.

No problem at all. It still is possible today if you really want:

   ~/> ocaml -rectypes
         Objective Caml version 3.08.3

   # let rec blackhole x = blackhole;;
   val blackhole : 'b -> 'a as 'a = <fun>

The problem is, though, that almost everything can be typed once you 
have unrestricted recursive types (e.g. missing arguments etc), and 
consequently many actual errors remain unflagged (which clearly shows 
that typing is not only about potential value class mismatches). 
Moreover, there are very few practical uses of such a feature, and they 
can always be coded easily with recursive datatypes.

It is a pragmatic decision born from experience that you simply do *not 
want* to have this, even though you easily could. E.g. for OCaml, 
unrestricted recursive typing was removed as default because of frequent 
user complaints.

Which is why this actually is a very bad example to chose for dynamic 
typing advocacy... ;-)

- Andreas



More information about the Python-list mailing list