|
![](/i/fill.gif) |
...or not...
OK, so as you know, Haskell is a statically-typed language, much like
Pascal, C, C++, C#, Java, Eiffel, Delphi and God knows how many other
programming languages. What that means is that if (for example) you try
to multiply a Customer by a Date, you get a compile-time error, and your
program won't compile, so you can't run it.
Usually this is a Very Good Thing. However, if you're in the middle of
trying to refactor a complex piece of code, it can be annoying. You just
changed one part, and you want to quickly test it, but you can't because
you just broke the rest of the code in that module.
The latest release of GHC adds an interesting new feature. If you turn
this feature on, then type mismatches become compile-time /warnings/
instead of /errors/. So your code now compiles, and you can test the
bits you've fixed, without the bits you haven't fixed preventing the
compilation.
But what happens if you try to run some of the code that doesn't
type-check? Well, quite simply, it runs as much of the code as it can,
and then throws an exception.
To my knowledge, there aren't many statically-typed languages that let
you do this. Most of the time, you'd have to comment-out all the
incorrect code, usually by hand.
Then again, statically-typed, compiled languages which can also be
executed interactively are fairly uncommon in the first place, so...
Post a reply to this message
|
![](/i/fill.gif) |