[#70252] Re: [ruby-cvs:58640] nobu:r51492 (trunk): node.c: NODE_ALLOCA for ALLOCV — Eric Wong <normalperson@...>
Besides possible backwards compatibility, can we drop volatile
3 messages
2015/08/05
[#70257] [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI — ko1@...
Issue #11420 has been reported by Koichi Sasada.
11 messages
2015/08/06
[#70337] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/11
Nice. Thank you guys for looking into this.
[#70349] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/12
Btw, did you consider using flexible array to avoid extra malloc
[#70355] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Юрий Соколов <funny.falcon@...>
2015/08/12
I thought to suggest to embed hash_id_table directly into places when it is
[#70356] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— SASADA Koichi <ko1@...>
2015/08/12
On 2015/08/13 4:29, Юрий Соколов wrote:
[#70358] Re: [Ruby trunk - Feature #11420] [Open] Introduce ID key table into MRI
— Eric Wong <normalperson@...>
2015/08/12
SASADA Koichi <ko1@atdot.net> wrote:
[#70509] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — ko1@...
Issue #11276 has been updated by Koichi Sasada.
3 messages
2015/08/21
[#70639] the undefined behavior of an iterator if it is modified inside of the block to which it yields — Daniel Doubrovkine <dblock@...>
(this is my first time e-mailing list list, so apologies for any misstep :)
4 messages
2015/08/31
[ruby-core:70532] [Ruby trunk - Feature #8976] file-scope freeze_string directive
From:
akr@...
Date:
2015-08-21 22:18:07 UTC
List:
ruby-core #70532
Issue #8976 has been updated by Akira Tanaka.
Jeremy Evans wrote:
> I don't think the magic comment approach for freezing string literals is a good idea. For ruby libraries that are maintained, the maintainers will change their code so that they work when string literals are frozen by default (in ruby 3). For ruby libraries that are not maintained, the magic comment will not be added.
>
> I am strongly in favor of freezing string literals by default in ruby 3. Most of the objections I've read against freezing string literals by default are regarding breaking of unmaintained gems. I think all ruby needs is a command line flag (e.g. --freeze-string-literals=no|yes) or environment variable (e.g. RUBY_FREEZE_STRING_LITERALS=0|1) that sets whether string literals should be frozen by default.
I think chaning the default behavior without migration path is too big pain.
A command line option, --enable-frozen-string-literal, is also planned at the developper meeting DevelopersMeeting20150820Japan.
https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20150820Japan
https://docs.google.com/document/d/1e00tTj8ix2ofS8H2RiIMUhr39bABSc7AL0vk4KbtSF4/pub
Of course, its companion, --disable-frozen-string-literal, will be available too.
> With the command line flag or environment variable, you can test in ruby 2.3 that your code will work in ruby 3. In ruby 3, if you are using a library/app that doesn't work with frozen string literals, you can turn it off. Turning off frozen string literals in ruby 3 will make things work, but hurt performance for the entire application, which will give people a reason to fix the code. If you add the ability for per-file magic comments, it will encourage people not to make their code work with frozen string literals, and it will make it harder to reason about code that uses string literals, since you'll have to check for a magic comment every time.
>
> The only reason I can think of to support a magic comment for frozen string literals is if the maintainer of a library did not know how to make their library work when string literals are frozen by default. They could then use a magic comment and sweep the problem under the rug. Is that something we want to encourage?
file-scope directive enables us to update libraries incrementally.
We can't udpate all library at once.
There are too many libraries and authors.
Some libraries will be updated soon and other libraries don't.
We can obtain performance benefit from updated libraries.
This encourage library update with smaller pain.
----------------------------------------
Feature #8976: file-scope freeze_string directive
https://bugs.ruby-lang.org/issues/8976#change-53938
* Author: Akira Tanaka
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
Yesterday, we had a face-to-face developer meeting.
https://bugs.ruby-lang.org/projects/ruby/wiki/DevelopersMeeting20131001Japan
Several committers attended.
matz didn't attended, though. (This means this issue is not concluded.)
We believe we found a better way to freeze static string literals for
less GC pressure.
"static string literal" is a string literal without dynamic expression.
Currently, f-suffix, "..."f, is used to freeze a string literal to avoid
String object allocation.
There are several problems for f-suffix:
* The notation is ugly.
* Syntax error on Ruby 2.0.
We cannot use the feature in version independent libraries.
So, it is difficult to deploy.
* Need to modify for each string literal.
This is cumbersome.
The new way we found is a file-scope directive as follows
# freeze_string: true
The above comment at top of a file changes semantics of
static string literals in the file.
The static string literals will be frozen and always returns same object.
(The semantics of dynamic string literals is not changed.)
This way has following benefits:
* No ugly f-suffix.
* No syntax error on older Ruby.
* We need only a line for each file.
We can write version independent library using frozen static string literals as follows.
* Use the directive at top of the file: # freeze_string: true
Older Ruby ignore this as a comment.
* Use "...".dup for strings to be modified.
Older Ruby has small disadvantage: useless dup is called.
Note that the directive effects all static string literals regardless of
single quotes, double quotes, %q-string, %qq-string and here documents.
The reason that the directive is effective not only single quotes is
we want to use escape sequences such as \n in frozen string literals.
Also note that similar directive is already exist:
% ruby -w -e '
def m
end
'
-e:3: warning: mismatched indentations at 'end' with 'def' at 2
% ruby -w -e '# -*- warn_indent: false -*-
def m
end
'
The directive, warn_indent: false, disables "mismatched indentations" warning.
nobu implemented this feature in the meeting.
Please attach the patch, nobu.
--
https://bugs.ruby-lang.org/