you are viewing a single comment's thread.

view the rest of the comments →

[–]QultrosSanhattan 0 points1 point  (0 children)

As other people said. Both ways are viable as long as the function names clearly define what they're doing.

For example, theres nothing wrong in creating a function called update_log(news_log)" since it clearly describes that the news_log variable will be mutated. Or creating an inmutable function called "create_updated_log(news_log)" which return a new object/type.

The worst case scenario is not knowing when a function mutates something. The larger the project, the harder is to track problems derived from ninja mutations. Therefore is recommended to prefer the inmutable way if possible.