|
|
|
|
|
by mgoetzke
2984 days ago
|
|
a match(x) {...} to augment switch(x) { ... } would be very welcome indeed. It would also get rid of the function scopes which imply actual function objects/closures which are not actually needed. It would also remove the duplicity in the first example shown where match(res) matches on the statusCode field (I guess because `200` is declared as a literal ? while the variable is extracted out. Which also means you cannot match against variable content. It would also retain a level of readability while the proposed syntax has no readability for the uninitiated. Doing that too much makes the language harder to read and learn for beginners. My basic stance is that a language does not have to be perfectly concise but a good compromise between readability first and density second. It is always nice to optimize a language for experts but the majority of users of a language such as javascript are not veterans. |
|