Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've wondered about languages that are "hybrid" in the sense that the type system can be turned on and off, because from an intuitive sense, whether the language is meant to be used as a dynamic language has an impact on its design, similarly with a static language.

You take Smalltalk for example, as it is the original archetype of a language that benefit from blurring the lines of the type system. A language like Haskell on the other hand was design with the intention that the programmer would use the type system to do a lot of heavy lifting.

Of course, no real-world language is "pure" in that sense. We've graft type systems onto Smalltalk's "way of doing things", and the GHC Haskell compiler now allows you to treat type errors as warnings.



The change in GHC is just to make development easier. Basically, just imagine that instead of stopping at a type error, the compiler replaces the incorrect function with code to throw an error at runtime. So here the poorly typed function always errors, no matter what you pass it; in a dynamically typed language, it would work as long as the arguments passed at runtime have the correct types.

So it isn't anything like dynamic typing, or even quite like making type errors warnings--it's just a way to compile partially incorrect code to make changing the code incrementally easier. It's also not designed to be used in production.

It just automates the existing practice of temporarily commenting out offending functions and replacing them with `undefined' to get the whole file to compile.


> the GHC Haskell compiler now allows you to treat type errors as warnings.

Explain? Or post a link?

EDIT: found it: http://hackage.haskell.org/trac/ghc/ticket/5624




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: