From: danieldasilvaferreira@... Date: 2018-01-10T07:33:37+00:00 Subject: [ruby-core:84803] [Ruby trunk Feature#14336] Create new method String#symbol? and deprecate Symbol class Issue #14336 has been updated by dsferreira (Daniel Ferreira). Thank you very much Matz. I don���t mind to give my time on that task. For a long time I���ve been willing to contribute to ruby core but my professional contracts didn���t allow me. Today I believe the situation is about to change. I will ask my company the green light and will work hard on this endeavour once I get it. Something tells me that it will be possible. That ruby 3 is the right moment to make this happen and I trust a lot in my intuition. I agree with all of you that we should not allow ruby to break backwards compatibility without a clear transition path and try our very best to keep breakage at its bare minimum if we really must have it. I believe it is clear to everyone by now my passion for ruby and how much I think this situation is a big minus in the language rating standards which really impacts me in a daily basis since ruby as been a very important part of my life since many years and it will continue to be for many years to come. I am what I am today because of ruby. I can say it. If it wasn���t ruby I wouldn���t be able to be what I am today in professional terms so this commitment is my payback to all of you that have worked very hard to provide me the tools that allowed me to succeed. I will need some cooperation and support from experienced ruby core members to act as mentors on this task since it will be a comborsome task but we do have the time as our friend since ruby 3 is not gonna be out so soon. And in the end if we reach the conclusion it is not worthy then I will be someone with a very deep knowledge of cruby codebase and for me that is invaluable. How does it sound to you? ---------------------------------------- Feature #14336: Create new method String#symbol? and deprecate Symbol class https://bugs.ruby-lang.org/issues/14336#change-69517 * Author: dsferreira (Daniel Ferreira) * Status: Rejected * Priority: Normal * Assignee: * Target version: ---------------------------------------- From the discussions on the three previous issues related to the String vs Symbol subject ([5964](https://bugs.ruby-lang.org/issues/5964), [7792](https://bugs.ruby-lang.org/issues/7792), [14277](https://bugs.ruby-lang.org/issues/14277)) there are some conclusions we can assume: * Current String vs Symbol is not the ideal scenario. See: Matz and Koichi comments. * Current philosophy is to use Symbols as identifiers and Strings when strings are needed. * Current situation is that Symbols are being used in many code bases as strings except for strings that really need the String methods. * Current situation is that we are designing APIs to handle both String and Symbol inputs forcing an overhead of API development. I propose the deprecation of `Symbol` class and the introduction of `String#symbol?`. ```ruby foo = :foo foo.class # => String foo.symbol? # => true bar = "bar" bar.class # => String bar.symbol? # => false ``` For backwards compatibility transition path I propose: ```ruby class Symbol def self.===(var) warn ("Warning message regarding deprecated class") if var.class == Symbol true elsif var.class == String && var.symbol? true else false end end end class String def is_a?(klass) case klass when String true when Symbol self.symbol? else false end end end ``` -- https://bugs.ruby-lang.org/ Unsubscribe: