4 ms·
The thing which surprised me was not the variable shadowing, rather that the name "item" resovles to different variables on the left and right sides of the :=.
by colonwqbang 4y ago
The thing which surprised me was not the variable shadowing, rather that the name "item" resovles to different variables on the left and right sides of the :=. This is unusual language design, most languages assign a single meaning to each name in each scope.
- int_19h 4y agoIt's unusual for the C-style family, but very common in functional languages outside of it, such as the ML family. It's not uncommon to see repeated lines of the form: let x = ... x ... and every such line is a declaration of a new variable that shadows the preceding one.
- colonwqbang 4y agoNot in Haskell at least. What ML language are you thinking of?