Issue #14336 has been updated by dsferreira (Daniel Ferreira).


> You know, not every regular Ruby user follows ruby-core list

Isn't that obvious for everyone here? I thought it would be.

Let me tell you something then:

Real world problems are what matter the most when we design a language and that is why ruby is so awesome.
Because ruby was designed from the bottom up with that in mind.
In the real world people use the language features, people don't think about how to design the language in a better way.
They take the language features as granted and they create patterns to take advantage of those same features.
Ruby community is also awesome on that.
That is why Rails is an icon of technology followed by all other languages.
Cucumber, Rspec.
Even Github for me exists as it is today because of ruby. (but that is my impression, nothing else)
Ruby allows all that wonderful creativity to be put in real products as an artwork. Clear masterpieces.

Ruby core is a totally different world.
And in ruby core we should continue with the philosophy that took ruby up to here.
Ruby 3 will be out there.
It will be different but should be different for the better.
And in order to do that in ruby core the real world needs to be present in every decision.

In the real world symbols are being used for everything.
And that is the situation.
So they are not being used as they were meant to be.
And that is why I think ruby should fix that in ruby 3 in some way or another.


----------------------------------------
Feature #14336: Create new method String#symbol? and deprecate Symbol class
https://bugs.ruby-lang.org/issues/14336#change-69494

* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>