Today I Learned

hashrocket A Hashrocket project

Elixir Maps With String/Colon Keys Are Atoms

While running the Elixir 1.6 formatter against Today I Learned, this change caught my eye. The formatter changes maps like this:

%{ "short_name": "TIL" }

To this:

%{ short_name: "TIL" }

This change makes sense because "short_name": is just another way to use short_name as an atom key:

iex> %{"key": "value"}
%{key: "value"}

Elixir 1.6's formatter requires this more explicit syntax.

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.