Skip to content

Quote of the month

From project.ioni.st:

The power of static typing. 294 pages on how to use Arrays.

…about the new “Java Generics and Collections” book

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • Facebook
  • Twitter
  • Google Bookmarks
  • FriendFeed
  • Google Buzz
  • HackerNews
  • Posterous
  • Reddit
  • Slashdot
  • Tumblr
  • http://www.akropolix.net/rik0/blogs RiK0

    I think the problem is not static typing itself. The problem is that Java type system sucks.

    Haskell is static typed, but types don’t get in the way. They are a tool (a powerful tool, indeed), they help in your software development rather that requiring kludges to translate the intended semantic in the language syntax.

    The good thing with Haskell type system is that type checking forbids to do what you wouldn’t want to do in any case, while allows almost all meaningful programs.

    This is quite different from Java.

  • http://www.oluyede.org/blog/ Lawrence

    Yes, that’s right. I’ve nothing against statically typed languages. Types done right are a powerful tool. Hope to see more languages with types done right and “simpler” than Haskell

  • assman

    Haskell is not that simple. Try figuring out monads. Plus the edge cases in Haskell take a PHD to comprehend. I have no desire to read research papers on monads or modern type systems in order to get work done.

    OTOH dynamic languages are more powerful than Haskell (Haskell is not capable of interactive programming like in Rails or using a REPL), far simpler and way more maintainable since it is easier to change code that has fewer constraints placed upon it. Dynamic languages are also easier to learn and understand.

    Haskell has only one hypothetical advantage and that is that type safety supposedly substantially improves correctness. However this idea has never been proven.

  • http://www.oluyede.org/blog/ Lawrence

    assman: you’re right when you say that Haskell is not simple. It’s not, indeed. It’s gorgeous if you have a mathematically and logically skilled mind. Otherwise you’re kinda screwed in papers done by fellow mathematicians or really, really great programmers. Rik0 is a mathematician and he does research, that’s why he can enjoy Haskell unlinke us :)

    Anyway learning a statically typed language done right it’s useful.

  • http://www.akropolix.net/rik0/blogs RiK0

    I am (going to be) a matemagician indeed. No PHD or whatsoever :P . However, I have to say that I’m afraid Haskell is regarded as more complex than it really is. Python is a lot more simple (and even Ruby). However, monads are not that difficult. You don’t really need to know category theory.

    You can basically see monads as ‘successions of instructions that are performed in the correct order’. That is basically what monads are. Of course writing your own monads is more complex (but it is not necessary to do it).

    It’s like to say Python is complex because metaclasses are tricky. However, since most programmers don’t really use metaclasses, this does not make Python any harder.

    In fact I don’t understand what ‘Haskell is not capable of interactive programming’. You have got an interactive shell in Haskell too: that means that you can do interactive programming. Of course you would do it in a learning environment: when building systems, you will use a different style.

    You loose some dynamic possibilities (for example you can’t add methods dynamically in the way you do in Ruby — but in fact you also use a different style of programming, so this is not really an issue –), but you gain a lot of useful checks. Moreover you can easily manipulate functions dynamically: you can easily create new functions at runtime, and such.

    Haskell type system is very powerful, but is not intrusive like Java or C++. You don’t need to specify types: a method can be called on every object that has the right type (and with type I don’t mean ‘class’, I mean that it responds to the correct methods and such). Haskell type-system is about behaviour, not about ‘classes’.

    Haskell type-system only forbids programs that would have failed at runtime even in dynamically typed languages. In fact you don’t have less maintainable code. Some checks that you would have done empirically with tests are mathematically proven by the compiler/interpreter.

    And there are a lot of examples when programming in Haskell is far easier than doing the same thing in Python (provided you do know Haskell, and I don’t). For example since you don’t have to worry about state, reasoning formally on software is far easier. There are components that you have to guarantee are correct and sound. Tests are used, but don’t suffice. I’m not talking about mission critical software: I’m talking about compilers/optimizers and such. Writing such software in Haskell is easier. As is doing it in Prolog. It great symbolic manipulation facilities make it very suited to build that kind of software. Or some natural language manipulation tool.

    Of course it’s not suited to build a web-application.

    About Haskell, I have to say I read HSOE by Hudak and have to admit that programming in Haskell can be really funny (and easy) in fields you would not even think about: in fact the book uses multimedia to show Haskell capabilities. Quite interesting to see the very same language you have used to build a tokenizer is very suited to make robots animate on screen!

    Oh, well. I’m no Haskell advocate. I mean, my main programming languages remain Python and Ruby (with some C/C++/Java and recently a lot of Prolog — however, I have to admit my Prolog quite sucks).

  • http://www.akropolix.net/rik0/blogs RiK0

    A bit verbose, I suppose…

  • http://www.oluyede.org/blog/ Lawrence

    Ah ah no no, it’s because I have nothing to add :)

  • http://www.akropolix.net/rik0/blogs RiK0

    I forgot one thing… C++/Java types are not fully decidable at compile time (that is why you need the ‘lesser’ polymorphism). In Haskell types are fully (and automatically) decidable at compile time. That lets the compiler perform better optimizations at all. However, I find the whole thing quite funny.