You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system and platform: 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
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:
$ rackup
/Users/plundberg/.rvm/gems/jruby-9.1.16.0/gems/rack-2.0.4/lib/rack/builder.rb:49: warning: `frozen_string_literal' is ignored after any tokens
Puma starting in single mode...
* Version 3.11.3 (jruby 9.1.16.0 - ruby 2.3.3), codename: Love Song
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:9292
Use Ctrl-C to stop
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2018-04-04 10:59:46 +0300 ===
- Goodbye!
$ rvm use 2.5.1
Using /Users/plundberg/.rvm/gems/ruby-2.5.1
$ rackup
Puma starting in single mode...
* Version 3.11.3 (ruby 2.5.1-p57), codename: Love Song
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://localhost:9292
Use Ctrl-C to stop
^C- Gracefully stopping, waiting for requests to finish
=== puma shutdown: 2018-04-04 11:00:04 +0300 ===
- Goodbye!
So it seems, JRuby prints this warning if it encounters a frozen_string_literal comment in the middle of an eval 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:
@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.
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: