Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added automatic naming to allow anonyomous function expressions.
- Loading branch information
Showing
1 changed file
with
18 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30ad2e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guido van Rossum, Father of Python, said in Zen of Python:" Flat is better than nested".
So, I wish this feature could be limited back:
As said by Guido van Rossum in his official website criticizing JavaScript, if this above usage is abused, the readability of code will decrease significantly. Therefore, unlike JS, he forbids this feature by design in Python.
A code reader reading flat blocks without nesting one by one, seems easier. However, it will become more difficult and really much slower to read, when one block is nested by another too many times.
30ad2e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with you Yunfei, I really dislike this syntax.
It would also bring in some ambiguity with some commands.
For example:
30ad2e9
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this even implemented? It seems fine to me, most people know and understand Javascript.
If you really want to criticize it, just mention "symbol hell". There really shouldn't be a high concentration of symbols:
SetTimer((){
because it leads to unreadability.But really there shouldn't be anything wrong with extending
() => (MsgBox)
to() => {MsgBox}