mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
symbol.c: remove Symbol#id2sym.
In the ancient Ruby, symbols are represented by integers. In that era, to get string representation from integers, we used `Integer#id2sym` method. Later, `Symbol` was introduced, and `id2sym` was used for compatibility. Today, no one uses `id2sym` any longer. It is described in ISO 30170:2012 standard but I consider it as a mistake.
This commit is contained in:
@@ -657,7 +657,6 @@ mrb_init_symbol(mrb_state *mrb)
|
||||
MRB_SET_INSTANCE_TT(sym, MRB_TT_SYMBOL);
|
||||
mrb_undef_class_method(mrb, sym, "new");
|
||||
|
||||
mrb_define_method(mrb, sym, "id2name", sym_to_s, MRB_ARGS_NONE()); /* 15.2.11.3.2 */
|
||||
mrb_define_method(mrb, sym, "to_s", sym_to_s, MRB_ARGS_NONE()); /* 15.2.11.3.3 */
|
||||
mrb_define_method(mrb, sym, "to_sym", sym_to_sym, MRB_ARGS_NONE()); /* 15.2.11.3.4 */
|
||||
mrb_define_method(mrb, sym, "inspect", sym_inspect, MRB_ARGS_NONE()); /* 15.2.11.3.5(x) */
|
||||
|
||||
@@ -17,10 +17,6 @@ assert('Symbol#===', '15.2.11.3.1') do
|
||||
assert_false :abc === :cba
|
||||
end
|
||||
|
||||
assert('Symbol#id2name', '15.2.11.3.2') do
|
||||
assert_equal 'abc', :abc.id2name
|
||||
end
|
||||
|
||||
assert('Symbol#to_s', '15.2.11.3.3') do
|
||||
assert_equal 'abc', :abc.to_s
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user