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

Add support for undef #1654

Open
sampersand opened this issue Nov 28, 2023 · 2 comments
Open

Add support for undef #1654

sampersand opened this issue Nov 28, 2023 · 2 comments

Comments

@sampersand
Copy link
Contributor

Quite a few things in the standard library (and a few of my personal projects) undefine methods from parent classes (for example, Class inherits from Module but undefs refine and module_function). Having syntax for it would be helpful.

@soutaro
Copy link
Member

soutaro commented Nov 29, 2023

Hmm. The syntax would be something like:

class Class
  undef refine

  undef self.module_function       # Example for singleton method
end

And we can implement it by removing the entry from Definition#methods or adding a special entry.

@sampersand
Copy link
Contributor Author

The way ruby does it is it actually creates a new method in the class, but gives it the "UNDEF" visibility. We could try something similar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants