From: gltewalt@... (illocutionist) Date: 2004-11-10T12:28:32+09:00 Subject: Re: reverse #succ ? "trans. (T. Onoma)" wrote in message news:<200410270153.32461.transami@runbox.com>... > On Wednesday 27 October 2004 01:17 am, Hal Fulton wrote: > | trans. (T. Onoma) wrote: > | > Is there a reverse #succ for String? If not, could there be? > | > | It's one of those things that looks easy until you try it. > | > | There are too many "edge cases" that require judgment about how > | to generate the next value. > | > | Search the archives, it's been discussed off and on for five years. > > Thanks and yes the archives are back up. I found a few hits. I see the > problem. Though, I don't really care if it's a one-to-one match to #succ. I > would just prefer that my Range#reverse_each method doesn't blow up ;) > Certainly there must a basic #pred method that makes sense. > > Then again how much use does String#succ actually get? And what for? Can > anyone really give a use case truly dependent on the specific current > behavior? Would it make more sense if it were simply an ascii "dial", within > a particular range of characters? And perhaps too that particular range could > have a redefinable specal global. > > T. #pred leads to the gates of madness. Mr. Fulton is right in that it doesnt sound too hard to implement until you try it. I have used String#succ to ummm, 'test', the strength of passwords. The current implementation doesnt allow that if a password uses more printable chars than letters or numbers. An ascii 'dial' with a definable, or redefinable, range would be just perfect. ascci_succ ? 'z9'.succ => 'aa0' 'z9'.a_succ => 'z:' I just wonder if it should be a 'wheel' or 'dial', or if it should just have borders. 'a'.. 'the_end_of_the_line' of printable char range.