Actions
Feature #4184
closedString that has the same object_id in an each occurrence in a code
Feature #4184:
String that has the same object_id in an each occurrence in a code
Status:
Rejected
Assignee:
-
Target version:
-
Description
=begin
Regexp literals:
5.times { p /abcdasdf/.object_id } -> same!
String literals:
5.times { 'asdasdf'.object_id } -> different
Propose:
5.times { %c(asdasdf).object_id } -> same!
Example of usefullness:
a,b,c,d = data.unpack %c(ccNc) |
e,f,g,h = a.unpack %c(cvaN) | repeated many times
Aspects:
- String like 'ccNc' are created many times
- Not modified
- Used once in code
It is possible to write "class K; Format_ccNc = 'ccNc'; end"
but Format_ccNc will be used only once!
It is logical to make %c() strings frozen.
=end
Actions