a = [1, 2, 3]
b = a
b.append(4)
assert a == [1,2,3]
No matter which paradigm we use, there are going to be hidden traps new programmers need to learn. I think there might be fewer roadblocks in an immutable language because you can examine each function in isolation. There's a smaller chance a beginner will screw something up on line 10 which causes a problem on line 150. More moving parts makes it easier to get stuck on a buggy program.On the other-other hand, it is a slower ramp up to doing useful things. It's much easier to read/write to files and draw graphics in an imperative language.
If the immutable language has a single equality operator which makes it impossible to tell whether or not a value has been cloned, you might be safe from this issue.
Deep vs shallow operations is an issue in both imperative and functional programming. In python, you have '==' vs 'is' for different types of equal. You have deep vs shallow copy: https://docs.python.org/3/library/copy.html
I beg to differ. The real world is declarative. But as software developers we mostly suck at creating declarative ways to express problems. The spreadsheet being the one example of an intuitive declarative UI that non-programmers grok easily.
Your average corporate VP of engineering uses a declarative interface to issues charters to his developers: "You need to hit X performance target, Y cost of goods, and Z MTBF. By Date D. Go."
Declarative is the way the world works.
The industry will catch on, eventually.
You know, a very common newbie Lisp question is "why is my list still the same after append".
I bet you no Python beginner asks why their list is different after list.append(3), having expected a new list to be returned and the original one left alone.
Imperative is intuitive; the real world is apparently imperative. Though it can be described by functions in which t is just a parameter, the way those functions play out is that the past values of t are not available.
To take a more level view, the expectations w.r.t. append could be conditioned by prior exposure to other languages. However, any exposure to computers at all reinforces the imperative view. Almost all content is manipulated destructively: documents, settings, you name it.