Ingvar von Schoultz ingvar-v-s at comhem.se
Thu Aug 21 03:40:20 PDT 2008

Steven Johnson wrote:
> If intuitively-plain English is a requirement, we'll have to change some
> existing keywords... e.g., I submit that the meaning of "for" has little to
> do with typical English usage.

You can read "for..." as and abbreviation of "for each value i
between 0 and 5, do this."

Keywords don't have to be exact and complete. Given that the
"for" loop is useful and necessary, expressing it with "for"
is arguably the closest we can get.

Our starting point must be the constructs that are useful and
efficient in programming. Given these constructs, we try to find
suitable words. This means that keywords will necessarily be
inexact and incomplete.

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. All other keywords are closely related to their
in-program semantics in some way.

Regarding "for", a worse problem is this:

     for (var key in map) {...}

     for each (var value in map) {...}

Both constructs expand into the same plain-English sentence. I
think this would be better:

     for (var key in map) {...}

     for (var value in values map) {...}

     for (var [key, value] in [keys, values] map) {...}

Ingvar von Schoultz

More information about the Es-discuss mailing list