Projects

Ticket #714 (new defect)

Opened 21 months ago

Last modified 14 months ago

Hide certain methods on Symbol which are inherited from NSString.

Reported by: eloy.de.enige@… Owned by: mattaimonetti@…
Priority: blocker Milestone: MacRuby 1.0
Component: MacRuby Keywords:
Cc:

Description

An example is #include? but there might be others.

Attachments

symbol_bang.diff Download (1.3 KB) - added by mattaimonetti@… 14 months ago.
remove the string bang methods
symbol_not_string.diff Download (4.0 KB) - added by mattaimonetti@… 14 months ago.
remove all string only methods from symbols

Change History

in reply to: ↑ description   Changed 16 months ago by mike@…

Replying to eloy.de.enige@…:

An example is #include? but there might be others.

IRB session in 1.9.1:

irb: "string".methods - :symbol.methods
===> [:+, :*, :%, :[]=, :insert, :bytesize, :succ!, :next!, :upto, :index, :rindex, :replace, :clear, :chr, :getbyte, :setbyte, :to_i, :to_f, :to_str, :dump, :upcase!, :downcase!, :capitalize!, :swapcase!, :hex, :oct, :split, :lines, :bytes, :chars, :codepoints, :reverse, :reverse!, :concat, :<<, :crypt, :ord, :include?, :start_with?, :end_with?, :scan, :ljust, :rjust, :center, :sub, :gsub, :chop, :chomp, :strip, :lstrip, :rstrip, :sub!, :gsub!, :chop!, :chomp!, :strip!, :lstrip!, :rstrip!, :tr, :tr_s, :delete, :squeeze, :count, :tr!, :tr_s!, :delete!, :squeeze!, :each_line, :each_byte, :each_char, :each_codepoint, :sum, :slice!, :partition, :rpartition, :force_encoding, :valid_encoding?, :ascii_only?, :unpack, :encode, :encode!, :to_r, :to_c]

IRB session in MacRuby 0.5:

irb: "string".methods - :symbol.methods
===> []

I haven't been able to get llvm working on my machine, so I don't have a patch, but I suspect a fix would be to undefined the string methods above here:  http://github.com/MacRuby/MacRuby/blob/trunk/symbol.c#L766

  Changed 14 months ago by mattaimonetti@…

  • owner changed from eloy.de.enige@… to mattaimonetti@…
  • milestone set to MacRuby 1.0

  Changed 14 months ago by mattaimonetti@…

I'm attaching 2 patches, one to remove all the bang methods and the other to remove all the string only methods.

Changed 14 months ago by mattaimonetti@…

remove the string bang methods

Changed 14 months ago by mattaimonetti@…

remove all string only methods from symbols

Note: See TracTickets for help on using tickets.