Ruby is one of my favorite programming languages. Up until today I have never had any issues with it except to find work where I can code in ruby, so I started my own and the jury is still out on how that is working out.
Anyway, I just so happened to find a bug inside a major compiler, my 2nd bug ever found in near 30 years of fiddling with computers (I am 35 just for the record). My only other bug was in Delphi and was easily circumvented. My bug with ruby is an interesting one and I have been doing analyzes all day on it, and I can't see why this bug happens, there is nothing there to trigger it and ruby is open source and well hardened language.
Ahh before I go on, I perhaps should tell you what the bug is. It is extremely simple. Create an SKU like string
ph = "no.405.week"
then create a new variable like
b = ph+"5"
and b becomes rightfully "no.405.week5". Now do this :
b.delete ph
This above under normal situation would leave you "5", but it doesn't, it returns an empty string. No try
b = ph+"4" and do b.delete ph again and it will return 4. try with any number and it will work fine, except for 5 and 55 and 555 and so forth. Any other number will work. I tested this on a run loop and found for example that the number "55543" will return only 4.
Just to be certain that this is a bug with ruby delete function, I tried many other functions like gsub and all other functions work and now you know. I did try many other reverse domain names and unless the domain is just numbers everything works as it should.
ph = "com.blogpost.week"
b = ph+"5"
b.delete ph returns 5.
This is my blog and hosts my opinions on basically everything that I have opinions on
Tuesday, April 13, 2010
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment