Closed whatyouhide closed 1 year ago
Hello, I was wondering if this change had some other goal than reducing API surface, as I am not involved with the project so far I can't critique the choices but I'd like to offer my opinion on this and a usecase that I think goes "elixir way"
in some codebases MyMessage.new/1
was also used to pipe attrs into as:
attrs |> MyMessage.new()
so this change is deprecating a nice convinient way to build structs.
edit:
After some more thought I am realising that this pattern appeared exactly because of the previous lack of %MyMessage{}
and this tedious change will push the code into a better state. Thanks for your work.
one example: defaults |> Keyword.merge(params) |> MyMesasge.new
We now fully support struct building with compile-time defaults, so I think it's time to deprecate these and reduce the API surface.
This is already a huge library, and simplifying it is paramount (IMO) to keeping its maintenance sustainable.
The change from
MyMessage.new(attrs)
to%MyMessage{attrs}
is (tedious but) straightforward.