3 ms·
> For example, functional programming that copies an entire data structure every time you make a minor change or append is a real waste of the power of that par
by gorena 11y ago
> For example, functional programming that copies an entire data structure every time you make a minor change or append is a real waste of the power of that paradigm.
What do you mean by this? In the implementation, yes, is a poor optimization strategy, but for the user of the language, shouldn't that be what appears to be happening? Mutable data structures and functional programming mix worse than immutable data structure and functional programming.
> Or placing stateful actions into the same API set as FP expressions makes little semantic sense and discourages any sense of thoughtful structure to the different paradigms.
This is incredibly weird. You cannot get an array in Swift with an item at an index removed. There is a function to remove an item at an index from a mutable array[1], but no way to remove an index and return a new array. You can't do it. But you can "filter(:)", which returns a new array, and you can't "filter(:)" a mutable array to alter it. ...wat?
[1] - a thing that I'd argue shouldn't exist, when we must have mutability, it should be mutable references to constant arrays
- hellofunk 11y agoYou are assuming that copy on write is the only alternative to mutability.