ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:69951] [Ruby trunk - Feature #11346] [Open] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
       [not found] <redmine.issue-11346.20150712191159@ruby-lang.org>
@ 2015-07-12 19:12 ` stevej
  2015-07-12 20:18 ` [ruby-core:69952] [Ruby trunk - Feature #11346] " stevej
  2015-08-21 15:31 ` [ruby-core:70520] " ko1
  2 siblings, 0 replies; 3+ messages in thread
From: stevej @ 2015-07-12 19:12 UTC (permalink / raw)
  To: ruby-core

Issue #11346 has been reported by Steve Jorgensen.

----------------------------------------
Feature #11346: New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
https://bugs.ruby-lang.org/issues/11346

* Author: Steve Jorgensen
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
While I don't think it would be a good idea to change the behavior of the existing Symbol#to_s method as suggested in issue 11066, I think that it would be extremely useful to have some instance method of Symbol to perform that operation.

If such a method is added, it might be nice if String, and maybe even Object offered the same method so the operation could be performed with indifference to the target and so optimizations could be applied to Classes other than just Symbol (e.g. NilClass, TrueClass, FalseClass, and maybe for smallish values of Fixnum).

Perhaps, the new method name would be #intern_str, and if that is added to Object, the default implementation could be something like `to_s.intern_str` which would abide by the contract of always returning the same frozen string object (assuming #to_s does), even though it builds an ordinary string as an intermediate object, so is not optimized.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:69952] [Ruby trunk - Feature #11346] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
       [not found] <redmine.issue-11346.20150712191159@ruby-lang.org>
  2015-07-12 19:12 ` [ruby-core:69951] [Ruby trunk - Feature #11346] [Open] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze) stevej
@ 2015-07-12 20:18 ` stevej
  2015-08-21 15:31 ` [ruby-core:70520] " ko1
  2 siblings, 0 replies; 3+ messages in thread
From: stevej @ 2015-07-12 20:18 UTC (permalink / raw)
  To: ruby-core

Issue #11346 has been updated by Steve Jorgensen.


In the description, "(assuming #to_s does)" should read "(assuming #to_s returns equivalent strings)".

----------------------------------------
Feature #11346: New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
https://bugs.ruby-lang.org/issues/11346#change-53382

* Author: Steve Jorgensen
* Status: Open
* Priority: Normal
* Assignee: 
----------------------------------------
While I don't think it would be a good idea to change the behavior of the existing Symbol#to_s method as suggested in issue 11066, I think that it would be extremely useful to have some instance method of Symbol to perform that operation.

If such a method is added, it might be nice if String, and maybe even Object offered the same method so the operation could be performed with indifference to the target and so optimizations could be applied to Classes other than just Symbol (e.g. NilClass, TrueClass, FalseClass, and maybe for smallish values of Fixnum).

Perhaps, the new method name would be #intern_str, and if that is added to Object, the default implementation could be something like `to_s.intern_str` which would abide by the contract of always returning the same frozen string object (assuming #to_s does), even though it builds an ordinary string as an intermediate object, so is not optimized.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ruby-core:70520] [Ruby trunk - Feature #11346] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
       [not found] <redmine.issue-11346.20150712191159@ruby-lang.org>
  2015-07-12 19:12 ` [ruby-core:69951] [Ruby trunk - Feature #11346] [Open] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze) stevej
  2015-07-12 20:18 ` [ruby-core:69952] [Ruby trunk - Feature #11346] " stevej
@ 2015-08-21 15:31 ` ko1
  2 siblings, 0 replies; 3+ messages in thread
From: ko1 @ 2015-08-21 15:31 UTC (permalink / raw)
  To: ruby-core

Issue #11346 has been updated by Koichi Sasada.

Assignee set to Yukihiro Matsumoto

Any opinion?

----------------------------------------
Feature #11346: New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze)
https://bugs.ruby-lang.org/issues/11346#change-53923

* Author: Steve Jorgensen
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
----------------------------------------
While I don't think it would be a good idea to change the behavior of the existing Symbol#to_s method as suggested in issue 11066, I think that it would be extremely useful to have some instance method of Symbol to perform that operation.

If such a method is added, it might be nice if String, and maybe even Object offered the same method so the operation could be performed with indifference to the target and so optimizations could be applied to Classes other than just Symbol (e.g. NilClass, TrueClass, FalseClass, and maybe for smallish values of Fixnum).

Perhaps, the new method name would be #intern_str, and if that is added to Object, the default implementation could be something like `to_s.intern_str` which would abide by the contract of always returning the same frozen string object (assuming #to_s does), even though it builds an ordinary string as an intermediate object, so is not optimized.



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-21 14:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-11346.20150712191159@ruby-lang.org>
2015-07-12 19:12 ` [ruby-core:69951] [Ruby trunk - Feature #11346] [Open] New #intern_str or similarly-named method of Symbol to return a cached, frozen string (like "string".freeze) stevej
2015-07-12 20:18 ` [ruby-core:69952] [Ruby trunk - Feature #11346] " stevej
2015-08-21 15:31 ` [ruby-core:70520] " ko1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).