Hacker News new | ask | show | jobs
by gress 4404 days ago
Let is fine for defining constants, but it should also be used whenever possible for two reasons:

1. It gives you additional safety against accidental reassignment.

2. It gives the compiler a major optimization hint since the value is not a variable.

1 comments

The latter isn't really true when it comes to local variables. Compilers are pretty good at figuring that sort of thing out these days.
It is one of the reasons stated by Apple at today's WWDC session.