Hi there,
I like the new proposal and the benefits it brings. For discussion I just wanted to bring up that shadowing might be an issue here, just because (assuming a large data structure of say 10 fields) you end up with lot of nesting where each outer scope “pollutes” the inner ones. While the theoretical likelyhood of name clashes rises with each field, I could very well see that this isn’t an issue in practice, because:
- Field names will be different so name clashes are unlikely and
- The elm compiler won’t let you shadow anyway.
However with a lot of let
bindings in there name clashes could come up unexpectedly for intermediate result (e.g. unwrapping maybes or so) and might confuse beginners.
So maybe something to include into the discussion. Another thing that would be interesting is how Haskell behaves with the do
notation. Are the scopes somehow cleared there (which makes do
more than syntactic sugar) or does it have the same behavior and acts like nested functions? In the latter case maybe shadowing is not a big deal in practice.