Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is another take on #723 (an alternative to #734). As such it partially undoes #721 (parser changes).
It is still a hack, because
__class__
variables are now manages as global variables named$__class__NN
, not an ideal situation, but it is meant as a proof-of-concept for how a__class__
variable should behave. In particular, it seems that a__class__
variable behaves as a regular class scope variable that just happen to be initialized to the class type. For instance, it is possible to set__class__
to any value, even if it is not a type (e.g. it is possible to set it to a number), while setting the attribute__class__
is guarded against invalid values.Alternative implementations to global variables:
__class__
, placed in the class scope and lifted to be a closure cell; this is my favourite, but I was unable to get it work (2ac9d8c)__class__
; it works OK but only for non-top-level classes and still pollutes the namespace, this time the local one@slozier @isaiah @in-code-i-trust