6 ms·
The assignment with a "let" would probably be really easier to understand. On the other hand, in most programming languages today, assignment is done with the "
by chkas 7y ago
The assignment with a "let" would probably be really easier to understand. On the other hand, in most programming languages today, assignment is done with the "equal" symbol. This makes the code less noisy. Since the comparison operator is only used for "while" or "if", the risk of confusion is not so great.
- beagle3 7y agoMost definitely agree - once you get over it, it's not confusing it all. But statements such as "x = x + 1" ARE confusing to newcomers, from my experience. Essentially all Basic interpreters in the 80s accepted "let" to start assignment, but did not require it. Some (e.g. ZX Spectrum Basic) did require it.
- K0SM0S 7y agoYes, the problem is not that a seasoned practitioner cannot internalize just about any quirk, typically historical. The problem is that a first-time learner already has their mind full with information (we can only ever hold ~7 items in working memory, cognitively, so make sure each one counts when teaching anything).
- beagle3 7y agoThis reasoning taken a little farther would say that APl is by far the cognitively easiest language, which is demonstrably false. Also, it is unrelated to what I said - namely that “let” disambiguates the two meanings of the equal sign, which from my (and not just my) experience is a heavy cognitive load on people new to programming.
- K0SM0S 7y agoI was replying to this specific part, which I should have quoted. Sorry. > But statements such as "x = x + 1" ARE confusing to newcomers, from my experience Merely elaborating. Indeed, `let` does reduce cognitive load, it's one less "new thing" to keep in working memory¹ (this is the specific part of human cognition that we use to reason directly, "human RAM" for lack of a better term). I'm not sure how it's unrelated... nevermind. I got misunderstood in my comments all day, must be Venus. :) ____ 1: https://en.wikipedia.org/wiki/Working_memory https://en.wikipedia.org/wiki/Working_memory ____ Edit: I fail to see why this: > This reasoning taken a little farther would say that APl is by far the cognitively easiest language, which is demonstrably false. Could you explain?
- beagle3 6y agoSorry, I thought you were implying "let" would be one more thing to remember (taking one of the ~7 slots), and that's why we SHOULDN'T use it. > APL is by far the cognitively easiest language, which is demonstrably false. (that was a lower case L typing on phone, sorrt). APL code is incredibly short - 7 APL chars are usually equivalent to 50-100 in other languages. One would expect that would make it easy to master & read, but experience from the last 60 years or so shows that's not true.
- K0SM0S 6y agoAh, fair enough. Re-reading my comment, I once more failed to remove ambiguity. My bad. For clarity, we SHOULD use `let` with beginners, and any such pre-existing concept whenever possible. There's a time to reinvent some wheels I guess, but while first learning to drive certainly isn't it. APL, haha gotcha. Way to zero-in on the edgest perfect case! It indubitably shows how a "short" form is not necessarily cognitively "light", which has everything to do with familiarity in my book— a sizeable body of knowledge already internalized, already abstracted into a symbol or form— e.g. "let x", or a function whatever the abbreviation, the logical construct if... then... else, etc. Indeed should I speak to you in "objects you know" as a basis for language, chances are translation is possible between my ideas and those fundamental bricks of yours— some arragement thereof, that encodes whatever I want to convey. This is where/how actual pedagogy begins for me (totally layman perception, no formal training whatsoever). But failing the basic math background, these concepts fall back one-step removed from cognitive ease. I find it's extremely useful to speak in whatever domain language fits the student's background. Meet them halfway there so to speak, if I can help it.
- unwind 7y agoAs a C programmer, the idea that comparisons are only made in loops or ifs is very alien. Something like const bool press = (evt->flags & EVT_FLAG_PRESS) != 0; is common, idiomatic and nice in my world (for some made-up key event handler).
- userbinator 7y agoI deal with similar code, although for me, "!= 0" is usually discouraged; I would just use the result of & in a condition later, or if it must be turned into 0 and 1, the "booleanise" operator: const bool press = !!(evt->flags & EVT_FLAG_PRESS);
- chkas 7y agoThere is no boolean data type in easylang, so it is only needed in conditions.