Hacker News new | ask | show | jobs
by sph 955 days ago
It's just a hype phase. Types are cool, but in the past few years they seem to be the panacea for all problems, by inexperienced engineers that have got their first taste of Rust and Typescript. As if writing in Typescript would produce less buggy, more stable or more maintainable applications than using Elixir.

I'll say types are cool again before I get routed by angry static typing zealots.

3 comments

> As if writing in Typescript would produce less buggy, more stable or more maintainable applications than using Elixir.

I have news for you. A lot of people, including me, do know that catching an entire class of bugs at compile time makes your code less buggy.

The trade-off as usually stated is that more things are possible with more dynamic code, and statically typed code is slower to develop with.

Elixir has much more interesting features that have nothing to do with the types/no types discussion and I 100% agree it would be more interesting to discuss those instead.

> Elixir has much more interesting features that have nothing to do with the types/no types discussion

My point exactly. Sidetracking every Elixir discussion with complaints about type (especially when they are actually working on it!) gets tiring quick, when Elixir is much more than "just" a dynamic typed language. It's literally missing the forest for the trees.

I’ve worked in a lot of languages, from PHP 3 to Rust, F# and Typescript and a lot of others. So I’m relatively educated about their differences and pretty open minded about languages but I still don’t understand why there is still a debate about this.

I mean, I can understand that some language don’t implement types and that they have other advantages (Elixir is a nice example) but I still don’t understand why no typing is still seen by some people as an advantage.

What sort of code can you write in a non-typed langage that you couldn’t write with a typed one ? Newest type systems are mostly invisible and working by inference.

The greatest example is TypeScript : you can throw any untyped Javascript at the compiler and it will still infer the types allowing you to get great auto completion and to avoid logical bugs. Why would you prefer to not have this feature ?

For me, compile time checks aren’t even the real feature, I’d even say that they are useless because they come after the real features of typed languages which is your IDE proposing auto completion that is guaranteed to work. It’s an incredible way to discover the APIs when you know that something must exist but you don’t know how it’s named.

But I’m open to be proven wrong if someone can give me practical examples in which types are counterproductive.

If elixir had types, I'd use them. Right now I'm using it for functional programming aspects, coherent design across libraries, liveview, and the amazing OTP library. Those to me are much more important.

With proper discipline you can get a lot of type-like behavior if you use structs to represent your data and ensure they're being passed in function args through pattern matching.

it's waiting for you

{:type_check, "~> 0.13.3"}

Feels like it's still in flux/research phase
Frankly, we really need to instill the "types are cool" concept into inexperienced engineers. That insanely long phase in software engineering where people said dynamic types are cool was a huge mistake and ruined a lot of newbie minds.
"Think of the chil^H^H^H^Hinexperienced engineers! We must save them from PHP and Python!"

Enough pearl clutching. No one's mind was "ruined".