Project

General

Profile

Actions

Feature #7849

closed

Symbol#to_str

Added by trans (Thomas Sawyer) about 11 years ago. Updated about 11 years ago.

Status:
Rejected
Assignee:
-
Target version:
[ruby-core:52223]

Description

Even though a Symbol is not technically an honest-to-goodness String, from the standpoint of simple practicality it would help to have Symbol#to_str defined.

There are times when we want an argument to accept a String or a Symbol, but don't really want it to accept any type of object under the sun that responds to #to_s --which is just about anything. This is especially the case when writing DSLs. Having Symbol#to_str is the nice solution to this.

Defining Symbol#to_str may be an exception to the rule, but it's one worth making.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0