Live data from Hacker News

Writing code for both computers and humans

tonymottaz.com

31–32 of 32 posts

Re: Writing code for both computers and humans

#31
post #30
post #29

Earlier quoted context omitted.

(My top-level reaction to TFA, for background. I left it out because no-one asked.) > Writing code for both computers and humans Show me what you got. > isNaN(defaultValue) ? NaN : defaultValue Yuck. > This made me pause for a moment. Of course it did. I still pause every time I re-read it! > This ternary is much better. This is expert-level programming. This is how to write code with empathy for other programmers. N…

Half of what you wrote here has nothing to do with the context of this discussion (again), and the half that's at least superficially relevant is materially irrelevant as a consequence of being a strawman. > Java programmers don't think they hit NPEs, C++ programmers don't think they have ("modern") memory issues, and dynamic programmers don't think they have type problems Aside from the obvious category error, you a…

I don't know how you can think I'm arguing some mysterious, unrelated tangent.

--------------

>>>> {If `useControlledState` were just vanilla JS and no one were doing typechecking during development and build [1]}, there would have been {no problem with passing something else as an argument [2]}, because it will of course {evaluate to NaN anyway [3]} when undergoing the number treatment.

>>> The point of typing is to make sure this situation [3] doesn't happen.

>> Did you take note of the context in which this conversation is taking place? Because it doesn't make sense as a response within that context.

> What really prompted me to comment was your suggestion that it would have been better to {skip the confusing checks [1]}, {keep passing through an untyped object [2]}, and {let some downstream expression blow up [3]}.

--------------

>>> It's not about dynamic typing in this case.

>> It is about dynamic typing

I feel like you are so selectively blind to { isNaN(defaultValue) ? NaN : defaultValue; } being a wart of dynamic typing (not to mention TFA who had to slow down to understand it) that I couldn't do anything but submit other examples of selective blindness to see if they struck home:

>> Java programmers don't think they hit NPEs, C++ programmers don't think they have ("modern") memory issues, and dynamic programmers don't think they have type problems.

Why is it that you can write "People accustomed to strongly typed languages and thinking mostly of monolithic apps" but you bristle when I write "dynamic programmers"?

> The _entire_ point of what I wrote is laid out in my first paragraph: "People accustomed to strongly typed languages and thinking mostly of monolithic apps always pin things on dynamic typing even where it's not the cause." I even made it more explicit. This problem is not because of dynamic typing.

It's crystal clear and I'm contradicting you, not missing your point.

Re: Writing code for both computers and humans

#32
post #31
post #30

Earlier quoted context omitted.

Half of what you wrote here has nothing to do with the context of this discussion (again), and the half that's at least superficially relevant is materially irrelevant as a consequence of being a strawman. > Java programmers don't think they hit NPEs, C++ programmers don't think they have ("modern") memory issues, and dynamic programmers don't think they have type problems Aside from the obvious category error, you a…

I don't know how you can think I'm arguing some mysterious, unrelated tangent. -------------- >>>> {If `useControlledState` were just vanilla JS and no one were doing typechecking during development and build [1]}, there would have been {no problem with passing something else as an argument [2]}, because it will of course {evaluate to NaN anyway [3]} when undergoing the number treatment. >>> The point of typing is to…

What matters is not whether you—or any other confused commenter stuck in the second panel of the glowing brain meme—contradicts what I'm saying, but whether the facts do. They don't.

You have missed the point, and not just once. Not even twice.

> I feel like you are so selectively blind to { isNaN(defaultValue) ? NaN : defaultValue; } being a wart of dynamic typing

You seem selectively blind to the fact that (1) the code you are referring to is statically typed, not dynamic; and (2) that I have already addressed this—not even as part of some back-and-forth with you, but before you even waded in to this conversation with your condescending attempt to explain "the point of typing". (Gee, thanks.)

Post reply on HN