Closed anzhi0708 closed 1 year ago
Primarily, this was done to improve compatibility with Python code - it is possible to write a complete class
implementation, including class fields, methods, and decorators, which is equally valid in both Python and Kuroko, with some restrictions. The way this was implemented involved parsing class bodies specially - field assignments are a unique syntax in the language and do not work like normal let
declarations or even other assignment statements. In fact, in Python class bodies are normal function bodies, but in Kuroko class bodies must consist only of an optional initial docstring followed by field declarations and method definitions, possibly with decorators attached, but can not contain arbitrary statements or control flow structures.
This is VERY cool, it probably makes Python even more easy to understand, I love the scope design
This code won't work; can I ask why class fields must be declared without
let
?Very cool project by the way ;-)