News for hackers. Stuff that matters.
Re:Strong typing, a hill I'm willing to die on by dartos on Wednesday October 04, 2023 @09:32AM (#37764908)
Many dynamically typed languages have static analyzers, but retain the flexibility of not needing to prescribe types up front (it’s impossible to know exactly what data structure you need at the start of a project)

That’s the crux of why I’m not all in on static typing all the time. (Especially for networked programs that expect a wide range of different kinds of input)

Having to prescribe the types I need before I actually need them goes against how I tend to build.

Re:Strong typing, a hill I'm willing to die on by sfn42 on Wednesday October 04, 2023 @09:55AM (#37765229)
Sounds like you'd like C#. It does type inference with `var` and similar things, so you don't always have to specify types explicitly, but everything does have a type at compile time.
Re:Strong typing, a hill I'm willing to die on by Smaug123 on Wednesday October 04, 2023 @10:22AM (#37765651)
(C#'s type inference is so much worse than F#'s. I find it deeply painful to go back.)
Re:Strong typing, a hill I'm willing to die on by loup-vaillant on Wednesday October 04, 2023 @09:57AM (#37765256)
> Many dynamically typed languages have static analyzers, but retain the flexibility of not needing to prescribe types up front

Almost all static type systems have escape hatches that let you go dynamic when you really really need it. Also, I bet that most of your use cases for dynamic typing could be solved with a simple tagged union. Most people bemoaning the lack of flexibility of static typing just don’t know about how tagged unions can easily emulate dynamic typing when we need it, such that we rarely even need to reach for the actual escape hatches.

> (it’s impossible to know exactly what data structure you need at the start of a project)

Thankfully data structures are even easier to change with static typing: change it, gets a ton of type errors, fix them, done. With dynamic typing you run the risk of missing a call site.

> Having to prescribe the types I need before I actually need them goes against how I tend to build.

There’s type inference for that. I personally take advantage of it any chance I get.