I noticed implements
is a reserved keyword in JavaScript. However, I haven't come across any usage for that keyword. As a fact I know there's no concept of interfaces in JavaScript unlike other programming languages such as Java, which utilises implements
keyword when implementing an interface. Although I researched about it, I couldn't find the exact reason why JavaScript has reserved this keyword.
So, my question is is there any reason why this keyword is reserved?
CodePudding user response:
implements
is a Future Reserved Word which means it's a keyword, but currently doesn't have a meaning in the language.
The following words are used as keywords in proposed extensions and are therefore reserved to allow for the possibility of future adoption of those extensions.
The following tokens are also considered to be FutureReservedWords when they occur within strict mode code (see 10.1.1).
implements let private public yield interface package protected static
This list is different in the latest ECMAScript Language Specification since let
, yield
, and static
have received a formal meaning since.
The current Reserved Word section:
enum is not currently used as a keyword in this specification. It is a future reserved word, set aside for use as a keyword in future language extensions.
Similarly, implements, interface, package, private, protected, and public are future reserved words in strict mode code.
I don't see how the implements
keyword would refer to anything other than inheritance which suggests to me that technical committee 39 (the body formally responsible for the ECMAScript specification) hasn't ruled out the possibility of adding isolation/inheritance.
The process for getting a feature added includes an input phase. IDL for ECMAScript is an example of input that might come to shape this feature.
This repository is intended for an investigation into using an Interface Description Language (IDL) in the ECMAScript standard. It is not currently at a stage in TC39.