Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The example with <- is not an assignment, it is called shadowing and introduces new value with same name, old one isn’t changed

But I agree with some ad hoc words criticism



It is indeed assignment: https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...

shadowing would be a second 'let a = 2'


Yeah, my bad but the code from grandparent is also incorrect, as for it to be compilable variable must be declared as mutable.

That confused me, as I assumed that code there is compiling. But the only way for it compile is shadowing, so yeah, I kind of assumed that to shadow is to use this syntax. I'm not working with F# for some time, so should've checked before posting.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: