eval in Rack::Builder prints "warning: `frozen_string_literal' is ignored after any tokens" #5128
Milestone
Comments
@perlun We did not intend to not match MRI here so this is a bug. I am guessing they probably pass the frozen string lteral state to any evals which lexically occur with the source file or perhaps the strings somehow get annotated somehow on that first parse as being frozen. |
@enebo OK, great to get that confirmed. Let me know if you want some more help from me in nailing this one down. |
enebo
added a commit
that referenced
this issue
Apr 19, 2018
…ral' is ignored after any tokens". Silliest of the silly inverted logic.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Environment
Darwin ecvaawplun6.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64 i386 MacBookPro14,3 Darwin
Expected Behavior
When using this
config.ru
:I should be able to run
rackup
without any warnings.Actual Behavior
With JRuby, I get a warning; with MRI 2.5.1 (and 2.3.6) I do not:
I analyzed this down to https://github.com/rack/rack/blob/master/lib/rack/builder.rb#L49, where the failing code looks like this:
So it seems, JRuby prints this warning if it encounters a
frozen_string_literal
comment in the middle of aneval
statement, whereas MRI does not.I wonder how MRI actually handles the
frozen_string_literal
setting in that case - does it use unfrozen string literals for the code before that comment, and frozen string literals for anything that comes after it?Anyway, this is a semantic difference between MRI and JRuby that deserves to be documented, and potentially discussed.
The text was updated successfully, but these errors were encountered: