Ecma262: Editorial: “Else” vs “Otherwise”

Created on 6 Aug 2020  ·  7Comments  ·  Source: tc39/ecma262

Currently, ECMA‑262 is inconsistent in its usage of “Else” and “Otherwise” in algorithm steps that define the false branch of an “If” condition. We should choose one and use it consistently.


FWIW: [WebIDL], WHATWG’s [INFRA] and specifications depending on them consistently use the keyword “Otherwise”.

Most helpful comment

I agree it isn't a formal language. (Though that makes me wonder: if we hammered out a grammar for algorithms, would they suddenly stop being prose in your opinion?) However, I dispute that it's English prose. English prose doesn't have function-call syntax, or record constructors, or '?' and '!' appearing mid-sentence, etc. We could perhaps agree that it's a combination of English prose and various other constructs (generally from programming languages or mathematics). (And note that the "other constructs" have generally been increasing over the years.)

But setting aside the question of whether algorithm text is prose, there's the question of whether it's useful to refer to it as prose. Consider the spec's only use of the word, in 5.2.4 Static Semantics:

In some situations additional rules are needed that may be expressed using either ECMAScript algorithm conventions or prose requirements.

which draws a distinction between "algorithms" and "prose". Discussions in this repo have often followed this distinction, e.g. "use prose instead of an algorithm". In fact here is a comment where you yourself appear to be making this distinction.

In short: even if you believe that algorithm text is prose, referring to it as such may make your intent unclear.

All 7 comments

I count 309 "Else," and 131 "Otherwise,", which matches my expectation that "else" is what we prefer.

I think "otherwise" is more appropriate, as prose is natural language.

I think I expect "If ..., otherwise ..." and "If ..., else if ..., else ..."

I think "otherwise" is more appropriate, as prose is natural language.

To be clear, when you say "prose", you're including algorithm steps?

@jmdyck Yes, the contents of an algorithm step is English prose. There is some idiomatic phrasing used for consistency, but no formal language.

I agree it isn't a formal language. (Though that makes me wonder: if we hammered out a grammar for algorithms, would they suddenly stop being prose in your opinion?) However, I dispute that it's English prose. English prose doesn't have function-call syntax, or record constructors, or '?' and '!' appearing mid-sentence, etc. We could perhaps agree that it's a combination of English prose and various other constructs (generally from programming languages or mathematics). (And note that the "other constructs" have generally been increasing over the years.)

But setting aside the question of whether algorithm text is prose, there's the question of whether it's useful to refer to it as prose. Consider the spec's only use of the word, in 5.2.4 Static Semantics:

In some situations additional rules are needed that may be expressed using either ECMAScript algorithm conventions or prose requirements.

which draws a distinction between "algorithms" and "prose". Discussions in this repo have often followed this distinction, e.g. "use prose instead of an algorithm". In fact here is a comment where you yourself appear to be making this distinction.

In short: even if you believe that algorithm text is prose, referring to it as such may make your intent unclear.

The editor group has decided that the inconsistency in usage here is okay.

Was this page helpful?
0 / 5 - 0 ratings