Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change how class init is handled #14

Open
litlighilit opened this issue Jun 20, 2024 · 0 comments
Open

Change how class init is handled #14

litlighilit opened this issue Jun 20, 2024 · 0 comments
Labels
enhancement New feature or request sugar syntax sugar, e.g. macros

Comments

@litlighilit
Copy link
Member

litlighilit commented Jun 20, 2024

The class macro, derived from the old pylib, still rewrite the init function in a class definition block to a proc starting with "new".

But in Python, there is actually a __new__ method of each class, which is responsible to return a new instance. Thus this issue introduces the new function in a class being supported, and when new is defined, leave init only to init on the new-ed instance, and returns nothing.

@litlighilit litlighilit added enhancement New feature or request sugar syntax sugar, e.g. macros labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request sugar syntax sugar, e.g. macros
Projects
None yet
Development

No branches or pull requests

1 participant