Hi,
In message "[ruby-talk:02428] String#tr"
on 00/04/10, Quinn Dunkan <quinn / envy.ugcs.caltech.edu> writes:
|String#tr - translates search to replace, if search[0] == ?^ then translate
| not in search to replace
|
|String#tr_s - do the same thing except squeeze the string, same logic for ^
|
|Wouldn't this make more sense as
|
|String#tr(search, replace [, flags]) where flags can be COMPLEMENT and SQUEEZE
When I designed String#tr, first I thought of
String#tr(search, replace [, flag]) where flag is for true/false to squeeze
Then I changed my mind because mere boolean flags would make programs
harder to read.
But in the future, after keyword argument is intoduced (maybe in 1.7),
there can be keyword options for String#tr, e.g.
String#tr(search, replace, squeeze: true, complement: false)
Hmm, it's possible. It remainds me Common Lisp very much though.
matz.