Quantcast
Channel: Ruby Issue Tracking System: shevegen (Robert A. Heiler)
Viewing all articles
Browse latest Browse all 100

Ruby master - Feature #16666: 'string' - 'str' as a shortcut for 'string'.gsub('str', '')?

$
0
0

Does anyone else think the same syntax would be beneficial for Strings?

I do not doubt that it can be useful. One advantage of your proposal is that it
is very short and succinct.

Personally, though, I prefer .gsub() or .gsub!(), and .delete or sawa's suggestion.

I don't have anything against "-" per se and as you showed that Array has the
method, the same could perhaps be used for class String. But this may be a design
decision (I don't know).

But perhaps there is a design consideration matz considered (or not, I really do
not know). It may be best to ask matz about - for class String.

I would also recommend to contrast your proposal to what sawa suggested; for
example, you could propose - to be an alias of String#delete, or something
else. That may be helpful or perhaps simpler. (I myself really don't know)


Viewing all articles
Browse latest Browse all 100

Trending Articles