concept place in category kotlin

appears as: place, places
The Joy of Kotlin

This is an excerpt from Manning's book The Joy of Kotlin.

In contrast, replacing the call to the add function with its return value changes the signification of the program, because the call to log will no longer be made, so no logging takes place. This may or may not be important; in any case, it changes the outcome of the program.

5.3.2 Avoiding in-place mutation

Most data structures change over time because elements are inserted and removed. To handle such operations, you can use two approaches. The first one is update in place.

Update in place consists of changing the elements of the data structure by mutating the structure itself. This was considered a good idea when all programs were single-threaded (although it wasn’t). It’s even much worse now that all programs are multithreaded. This doesn’t only concern replacing elements. It’s the same for adding or removing, sorting, and all operations that mutate the structure. If programs are allowed to mutate data structures, these structures can’t be shared without sophisticated protections that are rarely done right the first time, leading to deadlock, livelock, thread starving, stale data, and all sorts of troubles.

Update in place