4 ms·
> no commonly used statically typed language helps here because they all allow null references This is false. TypeScript, Swift, and Rust are commonly used an
by tene 4y ago
> no commonly used statically typed language helps here because they all allow null references
This is false.
TypeScript, Swift, and Rust are commonly used and support non-nullable references.
> those languages, don't help you because you are dealing with real world data where inputs to your system can be null or not so you end up using some type system escape hatch anyway.
You don't need escape hatches to deal with "real world data" that may be missing some values. This blog post is my favorite detailed comparison of handling "real world data" in static vs dynamic languages: https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-type-systems-are-not-inherently-more-open/ https://lexi-lambda.github.io/blog/2020/01/19/no-dynamic-typ...
Rust's serde_json docs on "Operating on untyped JSON values" are also a pretty good description of working with "real world data" where you want to examine an arbitrary document: https://docs.serde.rs/serde_json/#operating-on-untyped-json-values https://docs.serde.rs/serde_json/#operating-on-untyped-json-...
The only requirement for working with "real world data" in a static non-nullable language is to choose whatever kind of behaviour you want when working with the data. Everything you can do with null references, you can do better with option types; there is nothing that null references uniquely permit.
- jacobsenscott 4y agoTypescript, swift, and certainly rust are not common languages by any stretch of the imagination. https://www.tiobe.com/tiobe-index/ https://www.tiobe.com/tiobe-index/
- semiquaver 4y agoIf you really think TIOBE is a reasonable way to gauge dev mindshare, fine. 1. Python with mypy has `strict_optional`. On by default. 2. C, being “portable assembler” is not really statically typed. 3. Java has had Optional for years, although it’s not the most pleasant to work with it does exist. And JVM languages like Kotlin go well beyond this. 4. C++ has `not_null`. 5. C# supports type-system enforced non-nullable types since 8.0. You said: > languages that disallow nulls, if you are one of the 10 programmers on earth working in one of those languages I hope it’s clear that you are simply incorrect. There are plenty of tools to eliminate nullable references in modern mainstream languages.
- gpderetta 4y ago> 4. C++ has `not_null`. Most importantly in C++ only pointers can be null. You can return value types that are not nullable.
- tene 4y agoDunno what to tell you dude; my imagination stretches there just fine. Maybe consider going to imaginary yoga class. There have been people writing at least two of those languages everywhere I've worked for a while. Most of my professional colleagues can write at least one of these comfortably. I'm extremely confident in being able to hire programmers for all of these. They're all in use at every major tech company. If you really want to stick your head in the sand and cry about how nothing can be better until they're literally top of the charts, I can't stop you, but they're certainly not rare. There's good stuff out there. Lots of people are using it. You can too. If you'd rather trade links to charts, I trust Stack Overflow's developer survey's methodology a lot more than TIOBE's. 30% of respondents said they've worked with TypeScript, and that jumps to 36% in the professional developer subset. Rust is 7%/6%. That's a hell of a lot more than 10 developers. https://insights.stackoverflow.com/survey/2021#technology-most-popular-technologies https://insights.stackoverflow.com/survey/2021#technology-mo... They also got 15% of developers who aren't using TypeScript want to use it, and 14% for Rust: https://insights.stackoverflow.com/survey/2021#most-loved-dreaded-and-wanted-language-want https://insights.stackoverflow.com/survey/2021#most-loved-dr... My country has about 15% black people about about 7% asian people. My country has about 4% LGBT people, and my city has about 15% LGBT. It would be really weird to hear someone say that black, asian, and LGBT people are not common, especially after knowing and working with plenty of them.