3 ms·
Types help avoid logical bugs at every scale, though of course bigger codebases will benefit more because the likelihood of having bugs also increases. Well-ty
by zozbot234 5y ago
Types help avoid logical bugs at every scale, though of course bigger codebases will benefit more because the likelihood of having bugs also increases. Well-typed programs don't go wrong.
> I also know three incredibly good programmers with 20-50 years experience each who all wrote in typed languages for years and then couldn't be happier not to have types when they moved to Ruby.
Typed languages from 20 to 50 years ago were very inconvenient to use and had poor compiler diagnostics that made type checking a lot less intuitive, so this isn't surprising. Modern typed languages though are very different and should not be conflated with legacy or historical ones.
- interactivecode 5y agoWhich modern language does typing really well? I would love to try a language in which it isn't frustrating to work with types. I use types at work in Typescript and Swift but honestly I'm not very convinced it's worth the hassle in most projects. I feel that if the build tool already can tell me what type I should be using, why do I need to pedantically add them everywhere?
- sodapopcan 5y agoI don't have a lot of experience with it and you would have to make the jump over to functional programming but I really like how Ocaml does types. It's all completely inferred by the compiler. This means you have to write very explicit code when it comes to casting--you can't even add an integer and a float without casting--but I don't think this is a bad thing. You can also explicitly type things if you want, and in that case it appears on its own line as opposed to mixed in with the function args. I vastly prefer this. I can't remember exactly what it looks like in Ocaml but in Elixir it looks like: @spec full_name(String.t, String.t) :: String.t def full_name(first_name, last_name) do "#{first_name} #{last_name}" end As someone who historically hasn't done any typing, I still find this a little noisy, but it lets me read the function as normal and can look at the spec only if there is any confusion.