by rubyn00bie · 2y ago · 0 comments
It (lack of magic) is one of the things I appreciated most, having originally come from Ruby and Rails. I’ve been using it professionally for nearly ten years, and I can say this isn’t a feature I’ve ever really wanted. My text editor can save the typing via shortcuts I type, and in doing so supports string keys, atom keys, has zero compile time dependencies, and no new syntax ;)
I’d really encourage you to put a note at the top of the readme that this shouldn’t be used in production code.
The formatter plugin features a "reverse" flag exactly to prevent any kind of regret like that. You can reformat your code automatically to remove all shorthand maps and remove the dependency in a couple simple steps.
> I’d really encourage you to put a note at the top of the readme that this shouldn’t be used in production code.
Noted, although I do think it's production ready. I'm going to keep updating the library if or when a new version of the Elixir compiler breaks it, and it does feature an easy way out in case I disappear.
The argument against it feels like "because we've always done it this way."
Pattern matching a large number of items off a map is verbose. Putting many new keys in a map can be verbose if they're existing variables.
I'd rather have shorter code that was just as readable than many lines that add to cruft.
[0] Reading `&%{foo: &1.bar}` as a new Elixir dev looks like character soup and is arguably more magical.