Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I personally don’t think this is a good idea, and I think the formatter plugin is going to give someone insane amounts of regret one day. It’s neat as “look what I did” but Elixir is all about removing magic.

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.



> I think the formatter plugin is going to give someone insane amounts of regret one day

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.


I don't agree that this is magic. It's only "magic" because the language doesn't do it today (thus requiring the compiler extension.) If this were in the language itself, it would probably be pretty popular.

The argument against it feels like "because we've always done it this way."


Agreed. It's just syntax, similar to implicit keywords (mentioned already) and & anonymous functions[0].

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.


i don’t like adding foundational syntax using libraries, but i do wish they would add this to the language. deconstruction by pattern is super common and the syntactic sugar would be most welcome.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: