logoalt Hacker News

jveyesterday at 9:43 AM2 repliesview on HN

As I understand that is the core design feature of any strongly typed language.


Replies

matt_kantoryesterday at 4:42 PM

I believe they're talking about gradual typing[0].

[0]: https://en.wikipedia.org/wiki/Gradual_typing

scotty79yesterday at 10:40 PM

Not really. Strongly typed languages don't usually support not having any types in your code (or any amount of gradual typing). At least not with any convenient syntax. There's usually some one clumsy "dynamic" type that doesn't interact with the rest of the system well and you'd be crazy to start writing your code using only this dynamic type.

I can't just write C++ like:

  any a = 1;
  a = "Hi!";
I also can't tell JS this shouldn't be allowed. But I can tell this to TS, at any stage of evolution of my program.
show 1 reply