-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyword.merge behaviour when a list is the second argument (docs/test) #5395
Comments
I'd love to take a stab at this :) Not sure I'm proficient enough with Elixir yet to fix the performance but I might as well try and learn :D Which reminds me, |
I am not sure yet how we should solve this issue but it is worth mentioning that most functions in keyword will accept "improper" keywords:
|
@PragTob |
What do we need to discuss in order to move this forward? :) |
As I understood it's me getting up my lazy... bottom to try and implement it that it only really works with kwlists but I haven't gotten to it for #reasons. So to not block this further, please anyone go ahead and implement it - I might still if I get to it. Thanks for triaging issues @whatyouhide ! :) |
@josevalim specs mention that both args should be keywords ( |
Looking at the history, we changed the On the other hand, we had to do changes like this one in the past to support mixed formats when interfacing with Erlang. Balancing the facts, I believe we should remain "pure", i.e. only keywords list allowed, because the cases we interface with Erlang are rather rare. So we should fix this, it is mostly a matter of finding the most efficient implementation. |
@eksperimental I don't believe it is backwards incompatible to change |
so should we fix any other function that takes improper lists or non-keyword lists? |
Similar to elixir-lang#5466 It makes sure a valid keyword is given as both arguments. Additionally, it adds tests to make sure Keyword.merge/2 and /3 work exactly the same way. Related issue: elixir-lang#5395
Environment
Current behavior
The current behaviour is that when Keyword.merge is called with a normal list as the second argument it just appends the list.
Expected behavior
Not sure, part of what this is about :) I see 3 options:
I'd have expected 1.) to happen but through the internal representation can also understand that 2.) might be a good course of action.
Thanks for all your effort + Cheers,
Tobi
The text was updated successfully, but these errors were encountered: