Hacker News new | ask | show | jobs
by sbrother 28 days ago
I was about to say "what, we've had records for decades" but then I read the changelog.

Interesting. I wonder if there a world where Elixir starts compiling maps to "native records"?

2 comments

Probably going to be replacement rather than direct recompilement of structs. I imagine all sorts of corner cases are lurking around if you swap implementation around, e.g. if someone force-pushed unknown key into a struct at runtime. Would be nice to keep current struct syntax though with the only difference in declaration
probably not maps, but structs yes.
I dunno… it’d break a looooot of code if structs were suddenly not also maps. My bet is this becomes a new option you have to manually migrate to.
Would it? I bet you could be very clever with transitional guards and the patching compiler to defensively handle both cases on detection of %{...}