"syntactic sugar" instead of "syntax sugar"

historically and in general use this phenomena is called as "syntactic sugar". I think we can change it for understand-ability and engineering convention.

https://www.computerhope.com/jargon/s/syntactic-sugar.htm
This commit is contained in:
Mustafa Kemal Tuna 2019-11-05 13:50:42 +03:00 committed by GitHub
parent dcb9d87ab8
commit 7e3e74fa5b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,9 +116,9 @@ alert(User.prototype.sayHi); // alert(this.name);
alert(Object.getOwnPropertyNames(User.prototype)); // constructor, sayHi alert(Object.getOwnPropertyNames(User.prototype)); // constructor, sayHi
``` ```
## Not just a syntax sugar ## Not just a syntactic sugar
Sometimes people say that `class` is a "syntax sugar" (syntax that is designed to make things easier to read, but doesn't introduce anything new), because we could actually declare the same without `class` keyword at all: Sometimes people say that `class` is a "syntactic sugar" (syntax that is designed to make things easier to read, but doesn't introduce anything new), because we could actually declare the same without `class` keyword at all:
```js run ```js run
// rewriting class User in pure functions // rewriting class User in pure functions
@ -140,7 +140,7 @@ let user = new User("John");
user.sayHi(); user.sayHi();
``` ```
The result of this definition is about the same. So, there are indeed reasons why `class` can be considered a syntax sugar to define a constructor together with its prototype methods. The result of this definition is about the same. So, there are indeed reasons why `class` can be considered a syntactic sugar to define a constructor together with its prototype methods.
Still, there are important differences. Still, there are important differences.