let-in if do-expr is problematic? (was: Re: proposal: let in if parentheses)
viktor.kronvall at gmail.com
Sat Aug 25 04:46:37 UTC 2018
The “let bindings in expression” originates in mathematics and logic.
I cannot speak for the original proposal but the major difference between
this syntax is that it evaluates to an expression compared to the let
statement which evaluates to undefined.
One benefit of “let in” is that it is easier to compose with other
syntactic constructs which expect an expression.
The semantics of the “let bindings in expression” is to evaluate the
expression after “in” with variables substituted by the definitions in the
bindings. Essentially, the syntax allows you to create a modified scope for
that one expression.
However, I find nested let expressions difficult to parse in my head and
would personally not suggest this syntax to be added to the language. I use
Haskell as my main programming language and there using the “where” syntax
often leads to easier to read code than using “let … in”.
2018年8月24日(金) 17:41 Darien Valentine <valentinium at gmail.com>:
> Herby, for those like myself who aren’t familiar with “classical let-in,”
> could you explain more about the objective? It’s not clear to me from the
> brief example what advantages this would provide.
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss