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

I always found 'let' to be such a strange name. What on earth is appealing about it?

The usual variable declaration syntax is <type> <name>; it's not a stretch to imagine the type as 'var', a catchall type. But 'let'? Let is a verb; it should be in a place where functions, not types, go. It makes sense in "let x in {}" type expressions, and it kinda makes sense in Lisp, but I don't see any argument for it in a C-like language.



It's math-y. As in "let n be a natural, ...".


> I don't see any argument for it in a C-like language.

The inventor of the C-like languages B and NB (which then inspired C) agreed and used the more intuitive auto.

  {
    auto x = 1; /* x is implicitly an integer */
  }
Now it's back in vogue in the C-like language C++. It doesn't mean "automatic storage", though.


>It makes sense in "let x in {}" type expressions

Without jumps, all code can be rewritten to be a series of "let x = ... in <expression>"

The fact Java has statements instead of everything being expressions is a design flaw and should be rectified not glorified.


Er. Why do you think that?


It's essentially what SSA is.




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

Search: