[Types-sig] how to do a typecase? (was: Static typing: Towards closure?)

Jeremy Hylton jeremy@cnri.reston.va.us
Sun, 23 Jan 2000 23:14:06 -0500 (EST)


>>>>> "JS" == skaller  <skaller@maxtal.com.au> writes:

  [On the subject of "def f(): return f"]

  [I wrote:]
  >> I don't see how we can specify a type for the function either,
  >> but I'm not sure that it's much of a loss.  Who cares if we can't
  >> typecheck programs with functions like "def f(): return f".

  JS> 	The point is that this function is the _simplest_ example of a
  JS> wide class of functions which will have the same problem.

  [...]
  JS> previous ones] but it isn't clear how to detect this in general
  JS> -- without eliminating useful (tractable) use of type recursion
  JS> such as:

  JS> 	type node = Node of node | Int of int

It isn't clear to me either, but I see that in Ocaml I can
successfully evaluate:
    "type node = Node of node | Int of int"
but not
    "let rec f () = f".
This suggests to me that it is possible to allow recursive types
without having a solution to latter problem.

Jeremy