News for hackers. Stuff that matters.
Re:38% of bugs at Airbnb could have been prevented by using ... by AnaniasAnanas on Sunday February 10, 2019 @11:04PM (#19131979)
> via Typescript

null/undefined is an inhabitant of every type in typescript, I would suggest purescript instead.

> Python relatively recently added typing

I think you mean the ability to add explicit types to variable names. It always had types.

> "extensive" unit testing is a poor man's type checker

Certainly.. iff you use dependent types.

> developers that don't think specifying types is helpful

Why specify types if they can be inferred? Why do work that our computers can do for us?

Re:38% of bugs at Airbnb could have been prevented by using ... by wwwigham on Sunday February 10, 2019 @11:09PM (#19131995)
> null/undefined is an inhabitant of every type in typescript, I would suggest purescript instead.

If you want absolute certainty in your types with TS, you should be using the `--strict` flag, which makes it so this is not the case.

Re:38% of bugs at Airbnb could have been prevented by using ... by evmar on Monday February 11, 2019 @01:05AM (#19132409)
"absolute" is a bit of a funny qualifier to use here, given the many soundness holes in TS.

For example (included with --strict):

https://www.typescriptlang.org/play/#src=class%20Base%20%7B%...

(I like TS, I just don't think it fully solves this problem!)

Re:38% of bugs at Airbnb could have been prevented by using ... by hardwaresofton on Sunday February 10, 2019 @11:16PM (#19132025)
> null/undefined is an inhabitant of every type in typescript, I would suggest purescript instead.

You're right -- but I've found in practice that strict null checking[0] is more than enough. Also I assume that Purescript has a similar bottom value as haskell[1] (please correct me if I'm wrong).

> I think you mean the ability to add explicit types to variable names. It always had types.

Yep -- I actually meant literally the `typing` module[2].

> Certainly.. iff you use dependent types.

You can get some good guarantees with container types (`newtype` in haskell terminology) that are constructed in a very specific way, assuming you have immutable values. For example, defining some type `NonZero<Int>` in typescript w/ `private readonly` interior value.

> Why specify types if they can be inferred? Why do work that our computers can do for us?

You're right -- I misspoke (misstyped?). By all means if inference is possible that is also fine.

Somewhat seperately, the statement stands as far as type signatures (i.e. `doThing :: Input -> Output` or `function doThing(in: Input): Output`) go -- they're great benefits to a codebase in my opinion.

[0]: https://basarat.gitbooks.io/typescript/docs/options/strictNu...

[1]: https://wiki.haskell.org/Bottom

[2]: https://docs.python.org/3/library/typing.html

Re:38% of bugs at Airbnb could have been prevented by using ... by smt88 on Sunday February 10, 2019 @11:08PM (#19131992)
> null/undefined is an inhabitant of every type in typescript

This isn't true as far the way you stated it. TypeScript types are not nullable by default.

How can you use existing JS libraries without supporting null anyway?