Hi everyone, I thought I had commented on this thread but apparently I have not, so apologies for the delay.
I am not convinced about this functionality because I honestly do not find this: new_map = post |> Map.rename_key(:user_id, :author_id) |> Map.rename_key(:body, :content) clearer than this: new_map = %{ user_id: post.author_id, content: post.body, ... } Maybe if you want to keep the other keys as is, then "rename_key" can be handy, but even then, what happens if you add a new key to post? Does it automatically appear in the new_map? Or should it not? Even if we say that "clearer" is personal, there are practical reasons for preferring the latter, such as the runtime can optimize it better (as all keys are literals and the map is not built dynamically), and it is easier to typecheck maps with known keys. So my $.02 here is that this is not something I would necessarily endorse and, if you really want to rename only certain keys inside a map, you can do it with a helper function or by using put+drop on the desired keys. Thanks! -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-core+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAGnRm4Js0nOTvsiJYapFhnzWZbBM7%3Dw8Z4QdrgGCTvhnCUBHNQ%40mail.gmail.com.