-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Repair Rails compatibility - Revert "Flatten Rack::Request::Env into Request" #1755
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
Conversation
This reverts commit d96b5c3.
FWIW I think we should fully revert #1751. The |
This reverts commit b050e74. Annotate `super()` call that started this whole adventure.
@tenderlove updated w/ a comment to forewarn others from this journey 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good. I have a couple suggested changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change looks good, I think the CHANGELOG line should be removed, not modified.
We are allowed to make breaking changes for Rack 3. According to https://github.com/rails/rails/blob/d5f517c136858e83adc209775416176ca5dda677/actionpack/actionpack.gemspec#L37 ActionPack should be able to transition appropriately. Regarding this change, I would say it's somewhat risky for ActionPack to pull in a module like this. Adding or changing methods may be problematic too, e.g. if we introduce a method which clobbers an existing one in Rails. |
Yes, we are allowed to make breaking changes in Rack 3, but that doesn't mean we need to. Removing this module just for the sake of removing the module and a call to FWIW I'm kind of happy about the flexibility a module provides. It means we can provide a way for people to compose a "Rack like" request object without forcing people to inherit from our Rack request class. |
Actually we removed the |
I'm easy either way, but my preference is towards composition rather than inheritance since I think it's easier to manage complexity. Therefore, I'd say we should be careful about the kind of design we encourage. |
tl;drMy goals was to make the code easier to understand for the next reader. I value clear, explicit code and community patterns (❤️ Rubocop #SorryNotSorry 😅). When something doesn't match, my gut says the author did it for a reason. I didn't have enough knowledge about Rack to have an opinion. I think we should merge this in its current state. It gets us back to before I opened my big My 2¢ (adjusted for inflation, w/ major caveat that much is shaped by the limits of my experience)Including a module defined within another class within another gem/library like Additionally, I'm more familiar with constructing a facade around an object I'd like to extend/coordinate with that I don't own. I didn't dive too deeply but I wonder why So what's the path forward for the long term? I'm not sure. I want to make time my schedule to read/learn more about |
Looking at the history, @ioquatix I think the argument for composition vs inheritance doesn't really apply here, if the choice is between having a separate |
def get_header(name) | ||
@env[name] | ||
end | ||
def initialize(env) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is supposed to be a mixin, why do we even define initialize
?
Surely this is up to the consumer to set @env
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that it's not what I expected when I entered the code base. I think things organically evolved as opposed to a coordinated conversation around how Rack's core is intended to be used/extended and with which patterns and assumptions.
This isn't my show so I'd be interested to hear how Rack's core team would intend/prefer the components of it to be extended. Ruby offers some powerful but complex inheritance and mixing tools that are fun to use, but I always prefer explicit encapsulation as I tend to not remember fancier programming after 3 months of absence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it break Rails if we remove it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with this as well. Since it looks like @ioquatix and @tenderlove already expressed they are in favor, I'm going to merge this.
reverts commit d96b5c3