On 6/19/07, <b class="gmail_sendername">Brent Yorgey</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I've started developing a library to support a "Perl-style" numeric type that "does the right thing" without having to worry too much about types...</blockquote><div><br>So, I just completed my implementation and decided to test it out by converting a simple program I wrote the other day (which exhibited lots of fromIntegers and such) to use my generic number type. When I was done converting, the code looked much simpler, which was nice. It type-checked and compiled just fine. And... didn't work. After a number of minutes of fiddling around, I finally realized that something which I "knew" was an integer was actually being represented as a Double internally due to some operator I had used previously, which was causing the isSquare function to always return False (equality of floating-point numbers and all that =P ). Adding a call to "round" fixed it, BUT I sheepishly realized that yes, I had just spent five minutes tracking down a bug that the type checker would have found for me had I not worked so hard to do stuff behind its back.
<br><br>Consider me chastened! *goes off to contribute to that wiki page that Henning started...*<br></div><br>-Brent</div>