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

Re: Optional types

This discussion got me thinking.  Now even old Lispers are willing to put in type information at least occasionally, for example to inform their readers.  Java (and other statically typed language) programmers point to the compiler helping (forcing them) to shake out all the type errors before running anything.  

My felling was that the compiler was just finding the bugs i'd find the first time i ran it, which is usually immediately after i write it.

Martin Fowler mentioned that some (maybe one) Extreme Programmers felt you get this same benefit (as compiler type checking) by writing unit test cases in a dynamically typed language, like Smalltalk or Lisp.  

So, what if the compiler could take those examples and use them to generate efficient code, the would certainly help type inference.  The resulting code might not be as efficient as having a type declaration language as Dan was talking about (i guess Common Lisp has something like this), but it could be fast and light.  

Hotspot optimization might do the same kind of thing, but might be easier to implement.  It might also fit in with Arc's idea of optimization by profiling.