Re: [elixir-core:9002] [Proposal] identity function

2019-07-30 Thread Steve Morin
+1 > On Jul 30, 2019, at 20:40, eksperimental wrote: > > `Function.identity/1`: I think you just hit the nail on the head with this > one. > > Nice middle ground > I'm +1 for this one. > > On Tue, 30 Jul 2019 12:46:53 -0400 > Allen Madsen wrote: > >> I don't have a strong opinion on this fu

Re: [elixir-core:9001] [Proposal] identity function

2019-07-30 Thread eksperimental
`Function.identity/1`: I think you just hit the nail on the head with this one. Nice middle ground I'm +1 for this one. On Tue, 30 Jul 2019 12:46:53 -0400 Allen Madsen wrote: > I don't have a strong opinion on this function's inclusion. It's not > mandatory that it live in Kernel though. It cou

Re: [elixir-core:9000] Add a is_mapset/1 function to Kernel

2019-07-30 Thread José Valim
Yes, we had debates about it and it is not the only time Dialyzer would complain. I believe simply pattern matching on %MapSet{} would generate warnings too. The one who has to change here is dialyzer (or Elixir's interface to dialyzer should provide reasonable alternatives for this - although I ha

Re: [elixir-core:8998] Add a is_mapset/1 function to Kernel

2019-07-30 Thread Norbert Melzer
Due to the opaqueness of `MapSet.t/*` such a macro isn't possible to implement without dialyzer complaining on its usage. José Valim schrieb am Di., 30. Juli 2019, 19:55: > Or to be more precise, we will add is_struct/2, which is a more general > feature than the one asked here. There is already

Re: [elixir-core:8998] [Proposal] identity function

2019-07-30 Thread Bruce Tate
+1 from me. -bt On Tue, Jul 30, 2019 at 12:50 PM Ben Wilson wrote: > I think having Enum.filter(list, &Function.identity/1) actually reads > pretty well. It avoids the issue with putting it in Kernel, and provides a > very explicit name which speaks to Bruce's goal of naming concepts. > > On Tu

Re: [elixir-core:8996] Add a is_mapset/1 function to Kernel

2019-07-30 Thread José Valim
Or to be more precise, we will add is_struct/2, which is a more general feature than the one asked here. There is already an issue tracking this. Thanks for the proposal! -- *José Valim* www.plataformatec.com.br Skype: jv.ptec Founder and Director of R&D -- You received this message because y

Re: [elixir-core:8996] Add a is_mapset/1 function to Kernel

2019-07-30 Thread José Valim
All of the “is_” macros can be used in guards and until Erlang/OTP 21 it was not possible to implement said functionality in a way that is guards compatible. We will drop support for OTP 20 once 1.10 is out (in January) so the proposed feature will exist in Elixir v1.11. -- *José Valim* www.plat

[elixir-core:8996] Add a is_mapset/1 function to Kernel

2019-07-30 Thread Debbie
Hi, today I needed to assert in a test that something was a mapset. I looked for a is_mapset/1 but I couldnt find one. So I created this one for my test: def is_mapset(%MapSet{}), do: true def is_mapset(_), do: false I was kinda surpised that there is no such function because there are similar

Re: [elixir-core:8995] [Proposal] identity function

2019-07-30 Thread Ben Wilson
I think having Enum.filter(list, &Function.identity/1) actually reads pretty well. It avoids the issue with putting it in Kernel, and provides a very explicit name which speaks to Bruce's goal of naming concepts. On Tuesday, July 30, 2019 at 12:47:08 PM UTC-4, Allen Madsen wrote: > > I don't hav

Re: [elixir-core:8993] [Proposal] identity function

2019-07-30 Thread Allen Madsen
I don't have a strong opinion on this function's inclusion. It's not mandatory that it live in Kernel though. It could exist on Function. Allen Madsen http://www.allenmadsen.com On Tue, Jul 30, 2019 at 12:29 PM Chris McCord wrote: > I’m just catching up on this thread now, but I’m in the “not

Re: [elixir-core:8992] [Proposal] identity function

2019-07-30 Thread Chris McCord
I’m just catching up on this thread now, but I’m in the “not valuable enough to be added” camp. I’ve personally never needed such an abstraction – on my own or while teaching. Also, an anon function serves the purpose when needed without introducing a new concept. From the beginner perspective,