We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our design goal, we hope to make it simple to upgrade most tuple records to native records. That is why native records use the same syntax as the existing tuple records except in declaration.
Our plan is to include native records in RC1 of OTP 29. In the later RCs of OTP 29, we will add support for native records to more applications, like syntax tools and Dialyzer. By OTP 30, we will add performance improvements and broader support for tools, as described in the EEP.
I wonder how the ecosystem will change once we have this. Would existing Erlang modules add support for records, or would we have to switch between records, maps, and tuples depending on what function we are using?
I wonder how it’ll work with Elixir’s structs too.
Everyone using the same data structure could be really valuable, hopefully it unifies us all somewhat.
Wishful thinking, but using Ash directly from Lustre w/o a JSON bridge would be awesome - as far as I understand, currently there is exactly this mismatch between essentially maps/structs in Elixir and records in Gleam that make this prohibitively difficult.
This very much. Gleam is a really pleasant language to use but I can’t build Ash in gleam using the same patterns and I can’t use Ash from gleam w/o a runtime translation cost so I’m kind of just waiting until that’s possible at that point.
So I wasn’t really sure what all that meant, but have found the details here:
Looks like the key feature is in that last line “more fields can be added to the definition without having to recompile all code that uses the record”.