News for hackers. Stuff that matters.
Re:Haskell Problems for a New Decade by magicalhippo on Friday January 24, 2020 @07:02PM (#22143537)
Static typing makes the code self-documenting though. Just yesterday I was looking at this code I found, my very first time trying Node.js:

    stream.on('data', function(data) {
        processStreamData(data, (results) => {
            callback(results);
        });
    });
Ok, I get `data` from the stream, I guess it's some kind of array, but what can I do with it? What exactly is it's type? I need to extract Int32's from the stream and operate on those, how do I do that?

So, as you say, I was forced to trigger the code at runtime, by inserting some debugging code that logged the type to console.

So for a simpleminded guy like me, static typing helps me a lot because it makes it easier to reason about the code I'm reading.

There are no comments on this comment yet.