Get the latest tech news

Show HN: es6_maps, new Elixir syntax feature via runtime compiler hacking


ES6-like shorthand syntax for Elixir maps: `%{foo, bar} = map; IO.puts(foo)` - kzemek/es6_maps

When writing code that heavily utilizes structures and passes complex objects through multiple layers, it's common to frequently use map literals. I believe that introducing a shorthand form of object creation to Elixir enhances the language's ergonomics and is a natural extension of its existing map literals syntax. es6_maps includes a formatting plugin that will convert your existing map and struct literals into the shorthand style.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of elixir

elixir

Photo of es6_maps

es6_maps

Related news:

News photo

What I mean when I say that machine learning in Elixir is production-ready

News photo

Show HN: Bloom – A shadcn like UI library for Elixir and Phoenix

News photo

Implementing Natural Conversational Agents with Elixir