Add frozen string literal comment to all files#167
Conversation
4d39e25 to
c4ad2bd
Compare
|
Hi @johnnyshields I have merged the PR #166, can you please update this PR. |
91f5495 to
ccca0bd
Compare
|
@ssinghi PR updated, please merge |
|
I thought a bit on this, and I am not very keen on this PR as ruby 3.4 makes frozen_string_literal true by default. |
Your comment is incorrect. Neither Ruby 3.4 nor Ruby 4.0 makes frozen_string_literal true by default. The switch-over change is unlikely to land until Ruby 5.0 in a few years. You can see a discussion in the Ruby language issue tracker here: https://bugs.ruby-lang.org/issues/20205 But even if Ruby did set it to true, this PR would still be necessary, because the code in kt-paperclip currently breaks when you set it to true. That is the point of this PR. See for example this line. But it is not enough to fix these cases as a one-off; we must also the frozen string magic comment everywhere in the gem, to ensure it remains compliant even for future changes. It is standard practice for all gems to add this frozen string magic comment, because it enables applications upgrade to use frozen strings by default everywhere. As per the Ruby discussion above, using frozen strings application-wide can result in a 5-10% speedup in real-world production applications. Of the 460 gems bundled in my application, there were only two gems ( |
|
I also think this should be merged. Its removing a lot of .rubocop_todo.yml lines. |
|
FYI I've been running this branch in production for over a week. No issues. |
This PR adds the frozen string literal comment to all files.
This is important so that Ruby apps using Paperclip and can enable frozen string literals everywhere in the future. Frozen strings everywhere are the future planned standard of Ruby.