Hacker News new | ask | show | jobs
by robto 1300 days ago
This may be a lost cause, but I don't think a beginner language should have mutable data at all. The only reason we really need mutability is for speed - our programs have to run on actual machines and for a long time we didn't have efficient ways of working with immutable data structures. It's a lot easier to reason about immutable data. And any non-programmer is not going to expect mutable data - from the beginning when they started learning math all the way up to MS Excel wizards, all the data has been immutable.

Mutation is a deep magic that learners shouldn't start with. It's pure premature optimization. Also everything should be expressions, no statements, why force people to learn extra syntax? Thank you for listening to my TED Talk.

...but thank you for making this tool! I love the IDE - simple, clear, and self-documenting!

3 comments

When I started programming at age ten, mutable data was t so simple and obvious it never occurred to me that it could be any other way, let alone what the advantages would be.
Mutating is not an issue for single threaded code that beginners write, and it is completely intuitive (unlike FP) so not sure what GP is thinking about.
Mutable variables are not intuitive for beginners. Out there in the "real world", non-programmers will happily write extremely complex Excel spreadsheets, SQL queries and even Pandas/Jupyter notebooks, but will become completely stumped even by simple for loops.

People will handle even very complex code as long as it's "just math formulas", but add mutation and temporal reasoning into the mix and it immediately causes cognitive overload.

Sorry, "temporal reasoning" is not on the table. And if someone is having problem dealing with loops then recursion must be completely beyond them and rocket science.

The examples you give are symptomatic of usage patterns, and the tools you name lend themselves to copy-paste constructs for beginners. That is all.

p.s.

> non-programmers will happily write extremely complex Excel spreadsheets, SQL queries and even Pandas/Jupyter notebook

but for the life of them would not be able to troubleshoot if the copy-paste operation had a hiccup.

Sorry, you just haven't dealt with any real-world scenarios and real-world people.

Yes, recursion is not acceptable.

No, this isn't about copy-paste. In the "real world" non-coders produce write-only code. (Nobody can read or reproduce somebody else's "formulas", but they will happily write their own, spanning multiple pages.)

Troubleshooting and writing complex code is acceptable for non-coders, as long as the programming language is not Turing complete. (The human brain seems to have real trouble processing Turing-complete constructs, it is somethig that needs explicit training. Recursion or loops doesn't matter.)

> Sorry, you just haven't dealt with any real-world scenarios and real-world people.

I've been a professional s/e since 1986. Have seen quite a bit and all varieties of dev teams, rest assured.

> In the "real world"

You seem to be arguing for the merits of e.g. Exel type of programming, which I have not addressed at all. We were actually discussing "beginners".

We call it "variable", because it's variable
McMaster University teaches w/ Elm (only the runtime mutates), which is probably more aligned with your interests.

http://outreach.mcmaster.ca/