Skip to content

Rake helpers extended #2

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

Open
wants to merge 3 commits into
base: fix-rake-global-namespace-pollution
Choose a base branch
from

Conversation

jasonkarns
Copy link

@jasonkarns jasonkarns commented Mar 12, 2023

Followup to #1 (and graphiti-api#91)

This alternative PR also extends the module in the task body. I'm curious of your use cases and opinions on if that's a good idea or not.

The downside is that self within the task (and thus the object being extended by the module), is still the main object. So in the strictest sense, this is still polluting the global namespace. However, the module is only extended when that particular task is run, so it does not affect the global namespace when other tasks are run. Personally I find that a reasonable tradeoff in general (and for that reason, I typically suggest (to my teams) the pattern of using local modules in their own files, and required+included/extended in the task body.

But since this is for a library, and the module-function invocation of these helpers is sufficient, I could see erring on the side of caution instead and opting to stick with #1 instead of this.

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

Successfully merging this pull request may close these issues.

1 participant