Tim Chambers
Tim Chambers
I presume you will have a way of turning that off once Ruby freezes strings by default?
Will this include [].freeze and {}.freeze? I would be quite interested in that mutation.
I guess my concern is the effort to add .freeze to literal strings now to kill mutations, when the strings will be frozen AFAIK in Ruby 3 by default.
In my case I have a lot of literal strings which are inline in code for internationalization. ``` I18n.t('class_title', klass: klass) ```
Yes it would be a bug, but one that would not encourage me to add .freeze to hundreds of them with Ruby 3 under development.
Still wrapping my head around that, but if I understand your code above, I would be telling rspec to expect that the I18n.t string is NEVER frozen, and if it...
I think that is a very good approach given MY code. Not sure how universal that would appeal.
@mbj - for me the freezing of array and hashes are going to be very helpful in focusing bugs. I have started to uses constants for the ones I deem...
I think freezing empty strings as well is for me also valuable because if they are frozen and then never modified it could be a spec gap.
I concur with that.