Live data from Hacker News

Elixir v1.20: Now a gradually typed language

elixir-lang.org

161–170 of 426 posts

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

#161

Earlier quoted context omitted.

It was poorly bolted on in Python. Well I dislike types to begin with, but aside from that, Typescript somehow did it better.

> Typescript somehow did it better I don’t think JavaScript’s syntax was ever designed with the idea that TypeScript would one day exist. Yet somehow it feels like it left the perfect open spaces for TS to later occupy.

They did get lucky with that. The Python type syntax ended up being similar, but the implementation of type-checking is confusing, also it was annoying how you needed to import the types of basic collections for a while.

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

#162
post #74

seems ironic that critics were saying, it needs typing, and all the elixir fans were saying you don't need typing, you don't get bugs related to typing because elixir is somehow magic, now they get typing and it finds bugs for them.... but you said you didn't need that to prevent bugs? But good to see! I spent a bunch of time trying out Elixir a while back, I enjoyed it, but just didn't agree with the lack of types.

It’s not so much language magic as it is “clustering preparedness” IMO.

Since any node in a cluster can be updated at any time and Elixir/Erlang code on the BEAM is designed make it easy to pass function calls to other nodes you don’t have any way of guaranteeing the Type contract between nodes. Types create a sort of false confidence in those situations where pattern matching handles everything very cleanly.

Example: You may not need to match on a full type, just a specific element name in a hash.

When people say Elixir doesn’t need types it’s not claiming that types are without value. It’s a claim that the mechanisms that already exist are enough without the added complexity.

I appreciate the gradual approach so that we can lean on both.

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

#163
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 infrastructure (infostructure) to more reliable typed languages happened to most of the Ruby on Rails (RoR) software unicorn stacks for examples Twitter, Airbnb and Shopify to name a few [1],[2],[3].

The main reason provided for these migration is transitioning away from monolith architecture, but almost all of the new programming languages being used are typed thus make it obvious that the untyped languages are not performant and difficult to scale even by changing the architecture.

[1] Why did Twitter move away from Ruby on Rails?

https://www.quora.com/Why-did-Twitter-move-away-from-Ruby-on...

[2] How Airbnb Scaled by Moving Away From a Rails Monolith:

https://www.reddit.com/r/programming/comments/1756q7z/how_ai...

[3] Is Shopify shifting away from Rails?

https://news.ycombinator.com/item?id=33409597

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

#164
post #85

Yes! I have the great luck to work in many different stacks as a freelancer. One of them is Elixir. While I am on this project for just half a year and not too many hours per week, I can say: I absolutely love this language. It reminds me of Haskell, which I had courses on at university, and is just an absolute joy to work with. My only gripe was that there was no typesystem. So I was eyeing Gleam (as I also like Rus…

How did you score freelance Elixir work?

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

#165
post #82

Earlier quoted context omitted.

> you don't get bugs related to typing because elixir is somehow magic, I've never followed Elixir particularly closely, but what I saw in some Erlang discussions was different. Discourse there was that you need to gracefully handle failure anyhow, so type errors can (should?) just get handled by the failure recovery machinery you're supposed to have anyhow. I disagree with that point of view, but it's much more defe…

OP might be referring to Jose Valim's 2023 ElixirConf talk where he's explaining why Elixir should go down the path of types. He gives a lot more nuanced take than 'types are useless', which is more like 'types are less useful than people think in the context of Elixir development'. (Which makes sense because he's in the middle of implementing a type system for Elixir.) https://youtu.be/giYbq4HmfGA?t=571

Yes, that is a great talk. He really does an admirable job of exploring all of the reasons why people think that they want a typed language and concludes many (but not all) are not that helpful.

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

#166

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…

People no can Rust so people no use Rust. Simple as.

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

#167
post #101

Earlier quoted context omitted.

Last I checked there were inacuracies. I am not sure if they have been addressed!

What were the inaccuracies? I'm not aware of any, but we can fix any that are found right away.

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 and Elixir, Gleam’s is written in Rust.
    Gleam has a more traditional C family style syntax.
    Elixir has a namespace for module functions and another for variables, Gleam has one unified namespace (so there’s no special fun.() syntax).
    Gleam standard library is distributed as Hex packages, which makes interoperability with other BEAM languages easier.
    Elixir is a larger language, featuring numerous language features not present in Gleam.
    Elixir has an official test framework with excellent support for concurrency, partitioning, parameterized tests, integrated error reports, and more. Gleam has no official test framework, but there are multiple community-maintained frameworks.
    Both languages compile to Erlang but Elixir compiles to Erlang abstract format, while Gleam compiles to Erlang source. Gleam can also compile to JavaScript.
    Elixir has superior BEAM runtime integration, featuring accurate stack traces and full support for tools such as code coverage, profiling, and more. Gleam’s support is much weaker due to going via Erlang source, resulting in less accurate line numbers with these tools.
    Elixir and Gleam both use Erlang's OTP framework. Both have additional modules for working with OTP, which provide APIs more in the style of each respective language. Both common use Erlang's OTP APIs directly, but Elixir can do so more conveniently and concisely due to having a less-strict type system.
    Elixir currently has superior deployment tooling, including support for OTP releases and OTP umbrella applications.
    Gleam’s editor tooling is superior due to having a more mature official language server, but Elixir has recently announced an official language server project which is in active development.
    Elixir is more mature than Gleam and has a much larger ecosystem.
    Gleam and Elixir compile at similar speeds due to using the Erlang compiler as their compiler backend. Elixir's macros are evaluated at compile time, so a program that uses macros will take longer to compile the larger the amount of work performed in macros. Gleam has no language features that result in slower compilation.
https://gleam.run/cheatsheets/gleam-for-elixir-users/ This has to much content to reproduce.

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

#168

Earlier quoted context omitted.

Conversely, TypeScript is my favourite type system because it has to support the wild things people did in untyped languages.

You didn't like Purescript? It looked pretty cool to me. Its main competition back in the day was Elm, but Typescript has now taken over. From a distance Typescript seems to have too many gaps. I haven't used it though.

I think TypeScript can feel like there's too many gaps because not enough people take it seriously enough to truly learn it. Hardly anyone reads a book about best practices/design the way many do about C/Java/Rust.

It's actually a very powerful tool when used thoughtfully. Although it wasn't the first structurally typed language I tried, it's the one that made me fall in love with structural type systems

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

#169

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…

I've used untyped languages extensively, and even built my own, and the errors I get at runtime are almost never type-based, and that's even more true now that LLMs can pump out code. For all the additional ceremony types add, I can't say I've personally realized their benefit.

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

#170
post #42

It's very nice updating Elixir, having no breaking changes across my many projects and it then the compiler just finds bugs for free. I'm so spoiled.

The stability of the language is such a blessing. I think that's part of the reason that LLMs do so well with it, despite its relative lack of popularity.

Which models do you use for elixir?
Post reply on HN