>From now on we're rewriting Enum.into/2,3 with empty map into Map.new/1,2 
during compilation. :)

On Friday, July 8, 2016 at 1:44:11 PM UTC+2, Ben Wilson wrote:
>
> I looked at having a fast path for Enum.into when I did the original 
> Map.new upgrades and we decided against it. When the goal is to create a 
> map from scratch |> Map.new is the clearest way to write that. The fast 
> path for Enum.into would require that the second arg is BOTH a map AND an 
> empty map, otherwise you can't use Map.new. If Enum.into(%{}) were the best 
> way to create a new map from some other thing it would be worth the extra 
> code path but I see Map.new as superior for that purpose. 
>
> I do agree that documentation in Enum could mention that. I'm inclined to 
> stick it in the moduledoc though because it applies to conceptually to the 
> whole module. By way of example, it's just as relevant to filter as it is 
> to map. 
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/a226c2e9-ffa9-4fa2-8035-e169a990d1e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to