Type safety + auto = win!

Nathan M. Swan nathanmswan at gmail.com
Fri Jul 27 15:18:53 PDT 2012


A story:

Playing around with functional programming, I started trying to 
implement interesting functions in Lisp. It all went well until 
"permute", a function which isn't that complicated but involves 
lists, lists of lists, and lists of lists of lists. This was so 
confusing and complicated that I gave up.

More recently, I tried it again in Haskell. It took less than 
twenty minutes! The reason was Haskell's type declarations, which 
made it so much easier to think about what was going in and out.

How this relates to D:

The type system can often get annoying, and become a pain (e.g. 
Java), hence the popularity of dynamic typing 
(Python/Ruby/Ecmascript). But when thinking about complicated 
algorithms and systems, they are a great structuring force. Which 
is part of why I love D: "auto" and "Variant" lets you forget 
about a lot of it, but you can still be explicit when it is 
important.

My two cents,
NMS


More information about the Digitalmars-d mailing list