Hacker News new | ask | show | jobs
by kbanman 3565 days ago
I've recently joined a team writing primarily in Clojure, whose proponents often tout repl-driven programming as a unique benefit to the language.

In a statically typed language (the stronger the better), aided by a good IDE, I don't need to be constantly executing my code against data during development; My editor is constantly validating my code, and when it stops complaining, my code will work. And months later when I or someone else uses that code in another part of the system, they won't need to execute that code to see how it behaves, as the types themselves provide documentation and as-you-code feedback.

3 comments

> my code will work

You mean your code will compile and run. Whether it behaves as desired is completely unknown without testing.

Let's say, "there is high probability that my code will work correctly right away". (This is especially true for Haskell.)

[Edit] To be fair, this is not only, and even perhaps not so much, due to the static typing per se but also due to the mental discipline the particular programming language may require from the programmer even to write code that can be successfully compiled.

> there is high probability that my code will work correctly right away

I'll bet my Python code has a similar probability of working correctly on the first run, conditioned on the complexity of the task.

Actually, based on my experience, what I found most remarkable about writing code in Haskell (which I admit I haven't done much of) is that I'd spend an enormous out of time wrestling with the compiler, but once I finally got all the type errors to clear out, the odds were surprisingly high that the code would "just work", which is not an experience I had with even other compiled languages (Java, C#, etc).

'course, it probably wouldn't work fast, and it was 50/50 whether I'd introduced space leaks, but...

> I'll bet my Python code has a similar probability of working correctly on the first run, conditioned on the complexity of the task.

Having developed professionally in both Python and Haskell, the probability for me was significantly higher in Haskell.

> conditioned on the complexity

Indeed, difference in complexity is the key here.

I'm confused. Are you agreeing with me?
It's a back-handed agreement. Static typing increases value with project complexity and head count. So yes, if you only ever do small tasks with low or singular head count, then dynamic typing probably works OK for you.
I would say 'a statically typed language aided by a type inference engine'. My biggest bugbears with statically typed languages go away when decent type inference comes into play.
with F# you have a REPL, it is not only prerogative of dynamic typed languages.
You could argue that with PowerShell you have an entire .NET REPL. And I have actually used it that way, particularly when I run into some function that has bad MSDN documentation.
Haskell, too. And these days you can even, if you really want, run things before they type check.