Making `for` simpler and more regular


#41

When I learn my first programming language, which is C, the most intuitive language feature to me is assignment. I found it’s difficult to imagine how an equation could be changed during time?

After I accept the concept of mutable variable binding, rest of the language features like for or while become reasonable.

What if I did not start from learning assignment?


#42

So as not to mislead anybody: I spend all day coding in it for clients, with three-day breaks here and there to do Scala training for companies that need to get engineers up to speed. (Nowadays I’m a consultant, working for Bill Venners at Artima.)


#43

Ok. I guess in my mind it didn’t sound the way you interpreted it, sorry about that :slight_smile:

Your post comes across a bit as “feigned surprise”

I tried to convene that I’d like to understand in what way people get to know and learn the language that makes this particular corner prone to confusion, because your experience is different to mine and I can’t tell how that went unless you tell me.

Regarding mental hiccups and writing bugs, they are going to continue to happen no matter how you alter the language. Mental hiccups are just that, I would not alter the language optimizing for mental hiccups, and writing bugs is something the language can attempt to ease but how do you make sure you are not unfolding a different kind of new confusions. We could list specific functionality in many languages destined to addressed specific kinds of bugs and those still happening (memory management in rust, null safety in kotlin, etc).

If the point is “behavior isn’t consistent with destructing in another context” then why only the pattern matching on val context is mentioned? Pattern matching exists in other places, which one is more relevant? why make it more like val, and not more like partial functions and collect like operations? Akka is pretty big in scala land, and recieve is such a partial function.

This is why I find it important to understand how you learned the language, and why some concepts stuck more than others in your head, to understand which contexts are more surprising than others. My case, for instance, is that I learned for as syntactic sugar for foreach, map, flatMap, and filter, back then I did not know about monads and the like nor I grasped the full extent to which it could be used, but I quickly mapped for comprehension to those 4 operations and I really liked the filtering capability.

So as not to mislead anybody: I spend all day coding in it for clients, with three-day breaks here and there to do Scala training for companies that need to get engineers up to speed. (Nowadays I’m a consultant, working for Bill Venners at Artima.)

Sort of same here.


#44

For the record, I spend a tiny portion of some days trying to catch bugs in the library and/or give advice about library performance. I’ve never worked on the compiler itself. That falls to cleverer people.

I do spend ~50% of my time working in Scala at work, though, so I’m not completely inept.


#45

Oops, that means I have the wrong mental map of your user name to your real name. Doh!