%{location: location, venue_name: venue_name} = struct
// process location and venue_name somehow
new_struct = %{location: location, venue_name: venue_name, extra_property: extra_property}
Is there any way in Elixir to do that similar struct desctructuring / creation shorthand (any way I can avoid typing venue_name twice), or how would I request it as a feature of the language in future iterations?
Look at the archives of the elixir-core mailing list. It’s been discussed and denied as a core language feature. Look to libraries or write your own macros/sigil if you really feel the need for it.
PS: There was a time where JavaScript was most hated for not being some other language one would much rather be working in. But I guess that was at a time where it was rare that anybody would learn to program in JavaScript first.
This should be another thread probably but that rebuttal is soooooo missing the point. But that is because it mix Design Pattern with architecture, which is a classic problem.