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

Remove most global "monkey-patches" #17471

Open
1 task done
MikeMcQuaid opened this issue Jun 11, 2024 · 2 comments
Open
1 task done

Remove most global "monkey-patches" #17471

MikeMcQuaid opened this issue Jun 11, 2024 · 2 comments
Labels
features New features help wanted We want help addressing this

Comments

@MikeMcQuaid
Copy link
Member

Verification

Provide a detailed description of the proposed feature

We should clean up extend/ to remove most monkey-patches (i.e. overriding/adding existing functionality) from core Ruby classes like e.g. String, Pathname, etc.

The exceptions should be:

  • those that mirror ActiveSupport e.g. present?, blank?, etc.
  • those that are extremely widely used (such as the above)

For monkey-patches used in formulae and/or casks: we should instead have modules included in e.g. Formula/Cask or refinements on e.g. Pathname so that they can be used as custom DSLs when possible rather than globally overriding methods.

What is the motivation for the feature?

  • More vanilla Ruby usage.
  • More clarify about when we're overriding functionality.

How will the feature be relevant to at least 90% of Homebrew users?

It won't be.

What alternatives to the feature have been considered?

Doing nothing.

@MikeMcQuaid MikeMcQuaid added help wanted We want help addressing this features New features labels Jun 11, 2024
@apainintheneck
Copy link
Contributor

Good idea! IMO we should prefer modules over refinements but either is better than what we have now.

@MikeMcQuaid
Copy link
Member Author

@apainintheneck Yeh, I'm not up-to-date with the best approach there but, in general, "monkeypatch instances rather than classes" feels like it's a better fit for us (and much easier than for other projects given how we load Formula/Casks).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
features New features help wanted We want help addressing this
Projects
None yet
Development

No branches or pull requests

2 participants