Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Atom key'd maps #11

@meyercm

Description

@meyercm

I've seen the discussion on why ShortMaps defaults to string keys, and while I personally am not swayed, I can respect that it isn't my project. Frankly though, I use atom key'd maps and structs all the time -- and because this macro is brilliant, I've just copy-pasted the code and changed @default_modifier in basically all of my apps, rather than using the Hex package and adding the trailing a.

Referencing discussion in the mailing list, irc, and issue #10 as evidence for how badly some folks (including me) despise the a, how do you feel about using ~m for string keys and ~M for atom keys? While the consistency with ~w/~W is slightly diminished, I think it's a decent compromise position. Additionally, this macro doesn't support interpolation, so the consistency with ~w is already sort of broken.

e.g.:

foo = 1
bar = 2
~m{foo bar} == %{"foo" => 1, "bar" => 2}
~M{foo bar} == %{foo: 1, bar: 2}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions