Skip to content

Conversation

eksperimental
Copy link
Contributor

@eksperimental eksperimental commented Oct 7, 2025

Elixir v1.19 introduces a warning related to structs,

 hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:

     user = some_fun()
     %User{user | name: "John Doe"}

 it is enough to write:

     %User{} = user = some_fun()
     %{user | name: "John Doe"}

Since this could be seen by new-comers to the language, offering a better user experience by avoiding abbreviations. Favoring the usage of "some_function" instead of "some_fun"

     hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:

         user = some_fun()
         %User{user | name: "John Doe"}

     it is enough to write:

         %User{} = user = some_fun()
         %{user | name: "John Doe"}

Since this could be seen by new-comers to the language, offering a better user experience by avoiding abbreviations. Favoring the usage of "some_function" instead of "some_fun"
@josevalim josevalim merged commit da20a70 into elixir-lang:main Oct 7, 2025
14 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@eksperimental eksperimental deleted the chore/some-function branch October 7, 2025 14:00
josevalim pushed a commit that referenced this pull request Oct 7, 2025
hint: given pattern matching is enough to catch typing errors, you may optionally convert the struct update into a map update. For example, instead of:

         user = some_fun()
         %User{user | name: "John Doe"}

     it is enough to write:

         %User{} = user = some_fun()
         %{user | name: "John Doe"}

Since this could be seen by new-comers to the language, offering a better user experience by avoiding abbreviations. Favoring the usage of "some_function" instead of "some_fun"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants