local

Peter Michaux petermichaux at gmail.com
Wed Aug 20 08:54:53 PDT 2008


On Wed, Aug 20, 2008 at 8:47 AM, Ingvar von Schoultz
<ingvar-v-s at comhem.se> wrote:
> Peter Michaux wrote:
>>
>> On Wed, Aug 20, 2008 at 8:21 AM, Ingvar von Schoultz
>> <ingvar-v-s at comhem.se> wrote:
>>>
>>> The keyword "let" breaks the very valuable JavaScript tradition
>>> of using intuitively meaningful keywords.
>>
>> I have read a lot of math proofs that start with "let x be the..."
>
> That's exactly the problem. The word makes perfect sense, it
> has an easily understandable meaning. And this meaning has
> nothing at all to do with the localness that the word is used
> for.
>
> The word suggests quite strongly that it's talking about the
> assignment. This is completely wrong, since it actually specifies
> the visibility scope of the name.

I think "let" is fine as there is a long precedence for it in Lisp and
at least in Mozilla's JavaScript implementation. It is short too.

JavaScript has some weird keyword uses. "var" means variable but
actually specifies scope also to the surrounding function. "function"
implies an actual function but JavaScript can have side effects
anywhere. "undefined" doesn't really mean something is undefined as it
could be defined to be undefined. Past wrongs don't justify future
wrongs. I just don't think "let" is a wrong (I actually like it.)

Peter


More information about the Es-discuss mailing list