aboutsummaryrefslogtreecommitdiffstats
path: root/ChangeLog
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-21 20:47:53 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-21 20:47:53 +0000
commit76da83bda95f1b8f304940a03647c51e1d4481ce (patch)
tree93119a59a19abdd3a1d931fc27c5828b234418e8 /ChangeLog
parent3df0c05d411576880a9e0aff16630fe5a9a08a99 (diff)
downloadruby-76da83bda95f1b8f304940a03647c51e1d4481ce.tar.gz
* vm_opts.h, iseq.c, iseq.h: add compile option to force frozen
string literals. [Feature #11473] This addition is not specification change, but to try frozen string literal world discussed on [Feature #11473]. You can try frozen string literal world using this magical line: RubyVM::InstructionSequence.compile_option = {frozen_string_literal: true} Note that this is a global compilation option, so that you need to compile another script like that: p 'foo'.frozen? #=> false RubyVM::InstructionSequence.compile_option = {frozen_string_literal: true} p 'foo'.frozen? #=> false, because this line is already compiled. p eval("'foo'.frozen?") #=> true Details: * String literals are deduped by rb_fstring(). * Dynamic string literals ("...#{xyz}...") is now only frozen, not deduped. Maybe you have other ideas. Now, please do not use this option on your productions :) Of course, current specification can be changed. * compile.c: ditto. * test/ruby/test_iseq.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ChangeLog')
-rw-r--r--ChangeLog35
1 files changed, 35 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index a18ae217f9..fd00ba1abc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+Sat Aug 22 05:31:37 2015 Koichi Sasada <ko1@atdot.net>
+
+ * vm_opts.h, iseq.c, iseq.h: add compile option to force frozen
+ string literals.
+ [Feature #11473]
+
+ This addition is not specification change, but to try frozen
+ string literal world discussed on [Feature #11473].
+
+ You can try frozen string literal world using this magical line:
+
+ RubyVM::InstructionSequence.compile_option =
+ {frozen_string_literal: true}
+
+ Note that this is a global compilation option, so that you need to
+ compile another script like that:
+
+ p 'foo'.frozen? #=> false
+ RubyVM::InstructionSequence.compile_option =
+ {frozen_string_literal: true}
+ p 'foo'.frozen? #=> false, because this line is already compiled.
+ p eval("'foo'.frozen?") #=> true
+
+ Details:
+ * String literals are deduped by rb_fstring().
+ * Dynamic string literals ("...#{xyz}...") is now only frozen,
+ not deduped. Maybe you have other ideas.
+
+ Now, please do not use this option on your productions :)
+ Of course, current specification can be changed.
+
+ * compile.c: ditto.
+
+ * test/ruby/test_iseq.rb: add a test.
+
Sat Aug 22 02:53:12 2015 Aaron Patterson <tenderlove@ruby-lang.org>
* ext/psych/*: update to Psych 2.0.14