Live data from Hacker News

Elixir v1.20: Now a gradually typed language

elixir-lang.org

391–400 of 426 posts

Re: Elixir v1.20: Now a gradually typed language

#391

Earlier quoted context omitted.

Nobody writes dynamically typed functions that can be called with any possible type. It's not about that at all. Static types give you errors reliably at compile time instead of randomly at runtime, better documentation of what the code expects (people writing dynamically typed languages eventually resort to type comments), working IDE support, reliable refactoring and better code, all of which results in faster deve…

> (people writing dynamically typed languages eventually resort to type comments) This has never been an issue in Elixir, because instead of a comment, you'd just improve the pattern matching in the function definition. def blah(%{students: [%{firstname: firstname, lastname: lastname}|[]], count: cnt}) when is_int(cnt): fullname = firstname lastname Is a valid function declaration, which specifies that blah takes a d…

is_int is doing the work of a type checker?

I mean I'm not an Elixer guy (not at all) so it's a bit opaque to me how that's not an enforcement of specific types (albeit the firstname, lastname can be anything?)

Once we get into the function itself, if two incompatible types, say a string and a filehandle.. (just random attempt, you may, if you choose, point to why the two types must have some alignment), what happens - the function dies?

That's my core issue with dynamic typing, you might argue that the function's explosion has a restricted blast radius, but that's not the point, the point is that the function was called, and was unable to compute whatever, and that's a bug.

Re: Elixir v1.20: Now a gradually typed language

#392
post #288

Oooh, here we go! As a professional Elixir developer for... 10-ish years now, I've been super excited about types coming. I'm very excited that the beginnings have started to land here. That said, I would love to know how the state of what's in v1.20 compares to un-spec'ed dialyzer. I was under the impression that dyalizer's "success typing" approach (not flagging a function if there are some combination of parameter…

I know this is blasphemy to the average HN reader, but as a professional Elixir developer for 10 years, never have I felt the need for stronger compile-time type guarantees. None of my production services have had downtime or crashes because of type errors. Sure, at times, for very data-intensive sections of the application I would have loved something a bit more complex than dialyzer, but the guarantees offered by O…

For me it's more the productivity and DX that suffer from lack of function arguments types.

Re: Elixir v1.20: Now a gradually typed language

#393
post #377
post #253

Earlier quoted context omitted.

Luajit and SBCL are very much performance competitive with the JVM? Why do you say that they're not? Random example benchmark: https://madnight.github.io/benchmarksgame/lisp.html

That's someone's 8 year old mirror of the benchmarks game website. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

Huh. And after eight years, SBCL and Java are side by side, still.

Re: Elixir v1.20: Now a gradually typed language

#394
post #100
post #46

Earlier quoted context omitted.

Do you like Rust or do you like Erlang? Writing Gleam is like writing Rust, writing Elixir is like writing Erlang. I don't know the current state of Gleam OTP, but last I checked it wasn't great. If you don't care about either of those things and only about types, use Gleam. But then why not just use Rust?

Hi, I'm the lead maintainer of Gleam. > I don't know the current state of Gleam OTP, but last I checked it wasn't great. Gleam uses regular OTP, it doesn't have a distinct OTP framework separate from other BEAM languages.

Right, I meant the libraries. I haven't used Gleam for a couple years at least though, so my opinions might be very outdated on this.

Re: Elixir v1.20: Now a gradually typed language

#396
post #377
post #253

Earlier quoted context omitted.

Luajit and SBCL are very much performance competitive with the JVM? Why do you say that they're not? Random example benchmark: https://madnight.github.io/benchmarksgame/lisp.html

That's someone's 8 year old mirror of the benchmarks game website. https://benchmarksgame-team.pages.debian.net/benchmarksgame/...

These mean nothing. The C/C++ implementations use SIMD intrinsic while Lisp doesn't (it should have used sb-simd).

Re: Elixir v1.20: Now a gradually typed language

#397

Honest question, in the era of vibe and AI assisted coding is there any advantages of using untyped programming languages, apart from the fact that non-typed languages has more traning data for the LLM? This probably controversial, but personally I consider untyped languages as technical debts that need to be fixed sooner or later, and the OP article is partly addressing this very issue. Rewriting critical software i…

> Honest question, in the era of vibe and AI assisted coding is there any advantages of using untyped programming languages, apart from the fact that non-typed languages has more traning data for the LLM? Author here. Type systems restrict which programs can be expressed and increasing expressiveness often requires increasing type-system complexity (which, speaking from experience, both humans and agents will struggl…

Types replace entire classes of tests that coverage metrics wouldn't detect [0].

Types are also documentation!

They also decrease the degrees of freedom LLMs have to make mistakes [1].

[0] https://kevinmahoney.co.uk/articles/tests-vs-types/

[1] https://john.regehr.org/writing/zero_dof_programming.html

Re: Elixir v1.20: Now a gradually typed language

#398
post #362

Earlier quoted context omitted.

There are two possible locations for comparison that I can see: https://gleam.run/frequently-asked-questions/#Elixir Here’s a non-exhaustive list of differences: Elixir is gradually typed, while Gleam is fully statically typed. Elixir's type system does not have generics, while Gleam's type system does. Elixir has a powerful macro system, Gleam has no metaprogramming features. Elixir’s compiler is written in Erlang a…

We should really remove the cheatsheets, they have not been maintained in many years.

Maybe, but I think they are handy for people who are trying to understand the language. I'd also congratulate you on writing them with such honesty.

Re: Elixir v1.20: Now a gradually typed language

#399
post #376

Earlier quoted context omitted.

Statically typing the underlying message passing model used in Erlang is pretty hard, because the mailbox of a process can accept any type of message. And so, it cannot be statically typed in general, since anyone who holds a process id can shove a message into that mailbox. In contrast, Go's message passing model works on typed channels. A channel has a type, and only accepts messages of the given type. The `receive…

Maybe you’re implying that message passing makes compile-time validation of messages difficult? The types themselves are a solved problem, as long as you allow actors to fail when they receive a message they can’t handle.

It's really not a problem to have actors fail like that so long as you're using structural types.

It in fact mimics what a lot of people are already doing with pattern matching.

So I don't think there is any real good reason to not allow enforcing static types, at least across your own part of the codebase anyways.

Re: Elixir v1.20: Now a gradually typed language

#400

Earlier quoted context omitted.

You might find Gleam[0] a better fit. [0] https://gleam.run/

I may be wrong, but last time I checked there was not a statically typed OTP implementation which is kindof a bummer. I think Gleam is the ideal implementation on top of the BEAM but it does just seem pretty immature.

It’s had it for a long time now: https://gleam-otp.hexdocs.pm/index.html
Post reply on HN