News for hackers. Stuff that matters.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by Veuxdo on Friday November 25, 2022 @10:18AM (#33743111)
Not for nothing, but static type checking isn't some kind of fad. It's been the rule, not the exception, since the 1980s at least.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by IgorPartola on Friday November 25, 2022 @10:30AM (#33743253)
For some languages it’s a whole lot more important than others. Python and JavaScript are memory-safe so you don’t need to worry about writing a bigger object into a too-small memory allocation.

You will discover that you reversed the order for parameters to a function by running your code with much less effort than annotating all your code. This type annotation is entirely useless:

    def get_user(email: str, create_if_not_exists: bool)
Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by pfdietz on Friday November 25, 2022 @10:36AM (#33743308)
Additionally, if you are testing the code anyway for other reasons (like, to check that the logic is correct), you exercise the dynamic type checking for free.
Re:Ask HN: Why the Linux Kernel doesn't have unit tests? by blep_ on Friday November 25, 2022 @04:47PM (#33747184)
And then it silently creates a user named True because the non-empty email address you passed as `create_if_not_exists` evaluated as truthy.