Hacker News new | ask | show | jobs
by JoachimSchipper 5663 days ago
Type inference (Haskell, C#) can be handy. Optional typing (many Schemes/Lisps, e.g. Gambit-C, SBCL or Clojure) is also an option.

I see your point, but dynamic typing is not the only way to get (most of) these benefits, and both of the above show significant performance boosts.

1 comments

It's really not that hyped up lately, but i really think that optional typing would be the best of both worlds in that matter. You can write your programs without thinking about types, and then you add types for safety/speed.

With a little bit of type propagation i think it would lead to quite a natural style of programming.

C#/CLR hints towards that from the other side with the dynamic type, but for syntaxic and cultural reasons, it won't be the same thing as a dynamic language allowing you to use types.

Also, Clojure type hinting is not at all optional typing, as it doesn't enforce types at all. It's purely for performance reasons, and i really think is the wrong way to go about things.

I once read lispers discussion on Qi language. One (actual) Qi user told us that he managed to prove that number 42 has type String.

This is the price of optional typings. It leave random holes in your program.

This paper presents an optional type system where type errors can only occur in the untyped sections:

http://homepages.inf.ed.ac.uk/wadler/papers/blame/blame-sche...