Re: [elixir-core:11432] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Zach Daniel
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

Re: [elixir-core:11431] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread 'Justin Wood' via elixir-lang-core
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: > >

Re: [elixir-core:11429] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Austin Ziegler
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

Re: [elixir-core:11429] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread José Valim
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

Re: [elixir-core:11428] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Zach Daniel
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`

Re: [elixir-core:11427] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Kurtis Rainbolt-Greene
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

Re: [elixir-core:11426] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Wojtek Mach
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

[elixir-core:11426] Re: [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Ben Wilson
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

[elixir-core:11425] [Proposal] Syntax sugar for Maps construction and pattern matching

2023-06-26 Thread Giorgio Torres (Eugico)
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 =>