Skip to content

Conversation

@BurdetteLamar
Copy link
Member

Main goal is for the examples to include Net so that Net::HTTP may be written as HTTP. Also revises certain examples so that they may be executed without errors.

I hate to put in such a big PR, but having made the mods in examples.rdoc, I had to make appropriate changes in the three files that include it.

@BurdetteLamar BurdetteLamar added the documentation Improvements or additions to documentation label Jan 26, 2023
Copy link
Member

@peterzhu2118 peterzhu2118 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of including the Net module so that we can remove the Net:: prefix. By including all of Net, every class/module under Net will be available in the level that you included it in (or in the top level if it was included in the top level). This makes it difficult to understand where a specific class/module comes from (e.g. most users know Net::HTTPRequest comes from this gem but will be confused when they see just HTTPRequest). It also pollutes the top level as every constant in the Net module will be part of the top level, thus increasing the probability of name collisions. This is also an abuse of includes, since including a module means that your code requires all of the code of the module being included to function.

@BurdetteLamar
Copy link
Member Author

I'm not a fan of including the Net module so that we can remove the Net:: prefix. By including all of Net, every class/module under Net will be available in the level that you included it in (or in the top level if it was included in the top level). This makes it difficult to understand where a specific class/module comes from (e.g. most users know Net::HTTPRequest comes from this gem but will be confused when they see just HTTPRequest). It also pollutes the top level as every constant in the Net module will be part of the top level, thus increasing the probability of name collisions. This is also an abuse of includes, since including a module means that your code requires all of the code of the module being included to function.

Got it. I'll leave this up for a bit, in case others want to comment. Meanwhile I'll collect the other changes (some of which are corrections) for a new PR.

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants