Hi,

I have been running into the same issue again and again with elixir where I 
get a weird error like 

> (Protocol.UndefinedError) protocol Enumerable not implemented for "foo". 
> This protocol is implemented for: DBConnection.PrepareStream, DBCo 
> nnection.Stream, Date.Range, Ecto.Adapters.SQL.Stream, File.Stream, 
> Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, 
> Postgr ex.Stream, Range, Stream, StreamData, Timex.Interval
>
when doing `Map.drop(foo, :sth).
Obviously i'm doing something wrong : I should give a list as a second 
argument but I keep forgetting and I bet i'm not the only one.
My proposal would consist in handling this case explicitly either by 
allowing for such a case to work or giving back a clear error message such 
as "Are you trying to do Map.drop(foo,[:sth]) ?".
I'm greatly inspired by the rust language in asking this, indeed rust gives 
you really great error messages when doing silly things.

I hope you find my proposal clear and interesting as it clearly is not just 
about Map.drop but also about giving better error messages to the developer 
when doing silly things which I think is important.

-- 
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/550f8801-c0d9-41ea-947a-8c3ee483c76a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to