The point wasn't about not typing long names :) Or about remapping. It was
about knowing when I have to know that the keys and corresponding variable
names were different, and when I don't.
Ultimately I think this either lives in core or nowhere else, and that if
people on a given project
For what's it's worth, I generally see people wanting this for map
deconstruction instead of construction. When it comes to deconstruction, we
already have a different syntax for maps with atom keys.
foo = %{bar: "baz"}
foo.bar
> Here is a really contrived example:
>
>
On Mon, Jun 26, 2023 at 5:31 PM Zach Daniel
wrote:
> I think the proposed syntax adds value and should be implemented as part
> of the core Elixir syntax. I also think it should not be considered for
> string keys, only for atom keys.
>
If the proposal were to only add this matching pattern
There is a very extensive proposal and discussion here:
https://elixirforum.com/t/proposal-add-field-puns-map-shorthand-to-elixir/15452
There is also very clear lines draw by myself on what this feature should
look like:
https://groups.google.com/g/elixir-lang-core/c/XxnrGgZsyVc/m/KgJwV8e-CgAJ
I think the proposed syntax adds value and should be implemented as part of
the core Elixir syntax. I also think it should not be considered for string
keys, only for atom keys.
Here is a really contrived example:
`%Struct{some_xy1_stup4d_8345324_name: some_xy1_stup4d_8354324_name} = value`
One of the coolest value adds of a thing like babel was that literally
anyone and everyone could take an afternoon to understand the plugin system
and write an experiment for the language and ship it to anyone and everyone
to try out. Because of the design if you wanted to remove yourself from the
Btw, you may want to check out
https://andrealeopardi.com/posts/a-story-of-regret-and-retiring-a-library-from-hex/.
> On 26 Jun 2023, at 21:58, Ben Wilson wrote:
>
> Hi,
>
> This has been proposed before. Someone came up with
> https://github.com/meyercm/shorter_maps which accomplishes this
Hi,
This has been proposed before. Someone came up
with https://github.com/meyercm/shorter_maps which accomplishes this as a
macro. It might be worth a discussion again at this point but it is worth
noting that this is a proposal that has been on this list before, and so it
would likely be
Hi,
I'd like to propose a syntax sugar for maps, specially for pattern matching
and construction.
# Map construction
language = :elixir
%{ language }
=> %{language: :elixir}
# Map pattern match
map = %{feature: :pattern_match}
%{ feature } = map
=> %{feature: :pattern_match}
feature
=>