Fergus Cooney f.cooney at gmx.co.uk
Sat Aug 23 06:16:37 PDT 2008

I'm sorry to be putting in my two cents on the "let" debate after so many
posts and people getting tired of it but I hope that my contribution is
original and useful.

Sam Ruby wrote:
> Perl uses "my".  Short.  Implies scope.

It's delightfully short and it does imply scope but, for me at least, I've
hated "my" ever since MyComputer. It's always struck me as somewhat
childish. My crayon, my computer, my variable. I'm sure I'd get used to it
but it does make me cringe. (My cringe!)

Jon Zeppieri wrote:
> Allen's BASIC point is a good one, and all I can muster in response is
> a (mostly) tongue-in-cheek reply: BASIC programmers who go on to learn
> other languages first find it necessary to unlearn BASIC.

I never liked "let" in Basic either. When it became optional it disappeared
from my programs and has never been missed.


I like Ingvar's "local" but I understand the point about "local" already
being part of the meaning of "var".

I propose another name for consideration and that is "here".

function foo (arg)
    var x = 1;
    if (arg.iffy_decision == 1)
         here x = arg.and_now_for();
         :  :
         here x = arg.something_completely_different();
         :  :

"Here" has no precendence in Basic or Lisp to confuse people coming from
those domains. It's also not mathematical - and that's a good thing.

Ingvar von Schoultz wrote:
> The problem with "let" isn't inexactness or incompleteness, it's
> that it's completely off the mark and unrelated, when read as
> plain English.

David-Sarah Hopwood wrote:
> It's not supposed to be related to plain English; it's supposed
> to be related to mathematical English usage ("let x be ...").

I don't agree. I don't think that "let" being mathematical gives any
advantage. I expect that for many scripters, if not most, programming is
more about logic, structure and meaning than it is about maths. "Here" is
meaningful and unambiguous.

Btw, someone's idea that [other words in the language aren't as meaningful
as their use, so why bother].. that's irrelevant, surely? Is there any real
reason not to pick the best fitting words wherever possible?

Richard Cornford wrote:
> While "let" is the type of word that does not lend itself to being used
> as a variable name, "local" may have been used to name something that
> embodied that concept.

"Here" is similarly hard to imagine being used as a variable.

Ingvar von Schoultz wrote:
> I think of |local x| as an abbreviation of |local var x|, so
> in the global scope I'd omit |local| and write |var x|.

I think that many would see "let x=.." as a shorthand for "let var x=.." and
the "let" isn't conveying the scope aspect of its semantics, in fact in the
expanded form it seems rather redundant. That's one reason why it was good
when it could be from Basic programs. It was extra typing but no extra

If "here x=.." is considered as a shorthand for "here var x=.." then it
gives the same meaning in both forms. In fact it's effectively a modifier on
"var" which states that it should not be hoisted, and "here x =" is
therefore literally a shorthand.

Brendan Eich wrote:
> Keyword connotations aside, let has clear denotation in many
> programming languages.

I'm not sure what languages you mihgt be referring to so are these languages
where the issue of scope is not as fuzzy as in javascript? If so, then "let"
doesn't have to convey the semantics of scope as it is being required to in

> I don't think it's worthwhile for the list to
> bike-shed too much when many on the TC39 committee have recently
> expressed support for let declarations.

I'm not sure what bike-shedding is but I hope there's room for a few ponders
over "here".

Brendan Eich wrote:
> But I'm dismayed that we're still coloring the shed.

Ah, I get that one better and in that case I think it's okay to be picky
about what paint we use - we'll be looking at it for a long time to come.

> The real issues are the binding semantics: hoisting, forward refs, etc.
> Jon Z made a bold proposal there.

Well, those are other real issues yet I do accept that for you guys who
are juggling the whole shebang they are the real issues. Still, I hope
that "here" might bring some harmony here.

.Fergus Cooney

More information about the Es-discuss mailing list