TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

My Future with Elixir: set-theoretic types

102 pointsby rukenshiaover 2 years ago

5 comments

xupybdover 2 years ago
I think people underestimate how powerful a tool strong types can be. If you make illegal states impossible in the type system you get a class of tests effectively enforced by the compiler.<p><a href="https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;designing-with-types-making-illegal-states-unrepresentable&#x2F;" rel="nofollow">https:&#x2F;&#x2F;fsharpforfunandprofit.com&#x2F;posts&#x2F;designing-with-types...</a><p><a href="https:&#x2F;&#x2F;khalilstemmler.com&#x2F;articles&#x2F;typescript-domain-driven-design&#x2F;make-illegal-states-unrepresentable&#x2F;" rel="nofollow">https:&#x2F;&#x2F;khalilstemmler.com&#x2F;articles&#x2F;typescript-domain-driven...</a><p><a href="https:&#x2F;&#x2F;erszcz.medium.com&#x2F;make-illegal-states-unrepresentable-but-how-the-typestate-pattern-in-erlang-16b37b090d9d" rel="nofollow">https:&#x2F;&#x2F;erszcz.medium.com&#x2F;make-illegal-states-unrepresentabl...</a>
评论 #33105609 未加载
评论 #33103424 未加载
AlchemistCampover 2 years ago
&gt; &quot;At this point in time, it seems the overall community would prefer a system that flags more potential bugs, even if it means more false positives.&quot;<p>I&#x27;m not sure this is true. While people who want static types are vocal about it , those who are happy with Elixir&#x27;s current balance of dynamic typing with help from guards and pattern matching are generally quieter since they&#x27;re well served by the language. At least of the Elixir devs I know, the overwhelming majority are not looking for a typed language. On the contrary, many of them moved to Elixir <i>from</i> Java or TypeScript because they didn&#x27;t like the rigidity.<p>It&#x27;s primarily people who haven&#x27;t ever really used Elixir or Erlang for significant work that make the most noise about &quot;needing&quot; static types. There are some exceptions, but for the most part this is the dynamic I&#x27;ve seen.
dmpk2kover 2 years ago
&gt; so we should not expect any meaningful performance gain from typing Elixir code<p>but<p>&gt; The Erlang compiler already does so to improve performance within a single module and we want to eventually do so across modules and applications too.<p>A bit confused by this. Will Elixir potentially embed types in BEAM files like Erlang increasingly does to inform the JIT, or not?
评论 #33105626 未加载
评论 #33105587 未加载
tommicaover 2 years ago
I write PHP and being able to give the arguments a type is such a nice thing, especially for self-documentation - hopefully this brings similar things to elixir, I really want to work with the language.<p>Besides that I wish for a really good LSP or other way to integrate to IDEs, especially to be able to jump to functions and see how they work exactly.
JediLukeover 2 years ago
I’m just gonna say this - Elixir flat out does not need strong typing. People who think it does, need to learn how to use structs, guards &amp; change sets properly. 99.9% of the time we are interested in “Accounts” or “widgets”, if it’s important enough to be in your domain model you can spend 2 minutes creating a struct for it, boom no need of types. I realize some very smart people work on Gleam and such, and I don’t really want to claim I know more than them, but seriously I think if you find yourself reaching for types in Elixir you just don’t grok that it’s a high-level language and types will only get in the way! Stop thinking like a C&#x2F;python&#x2F;JS programmer, start thinking like a prolog&#x2F;lisp programmer!! We want to get <i>away</i> from worrying about ints vs floats and deal with high-level constructs that match our domain model, NOT regress into strict typing.