tag:blogger.com,1999:blog-7206939994948735545.post7891258830985304286..comments2024-02-20T13:57:41.275+02:00Comments on Speaking my (programming) language?: Error detection with pattern matchingVassil Dichevhttp://www.blogger.com/profile/14522675986593535178noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-7206939994948735545.post-38741388434052314142010-08-07T11:23:49.956+03:002010-08-07T11:23:49.956+03:00This looks less like a success of pattern matching...This looks less like a success of pattern matching and more like a failure of equality to me. Your incorrect code would have been caught as a type error in most other languages.Jon Harrophttps://www.blogger.com/profile/11059316496121100950noreply@blogger.comtag:blogger.com,1999:blog-7206939994948735545.post-63826350553767324752009-11-25T11:52:42.390+02:002009-11-25T11:52:42.390+02:00OK, Scalaz 4.0 Pre-Release 1 works great with 2.7....OK, Scalaz 4.0 Pre-Release 1 works great with 2.7.7, not only does === warn if the types don't match, but it also converts one of the arguments if there's an available implicit conversion, which matches.Vassil Dichevhttps://www.blogger.com/profile/14522675986593535178noreply@blogger.comtag:blogger.com,1999:blog-7206939994948735545.post-54933383032435116332009-11-25T11:21:32.640+02:002009-11-25T11:21:32.640+02:00@Squirrels Ewer
I had problems making scalaz work ...@Squirrels Ewer<br />I had problems making scalaz work in Scala 2.7.7 and 2.8 RC1, but looks like it should work, it uses an implicit to convert to Equal, and then uses the type-safe method order(a1: A, a2: A). Although I find the conflict with the same operator name from ScalaTest a bit unfortunate, I think this is the way to go.<br /><br />@Spiros<br />True, in Scala 2.8 "reverse" works, because the String is converted implicitly to a WrappedString, where "reverse" returns String. This will not help with the general problem where you're comparing an implicitly converted object with an object of the original type.Vassil Dichevhttps://www.blogger.com/profile/14522675986593535178noreply@blogger.comtag:blogger.com,1999:blog-7206939994948735545.post-73334996048038383132009-11-24T18:59:48.547+02:002009-11-24T18:59:48.547+02:00Nowadays, many defects, e.g., obscure error genera...Nowadays, many defects, e.g., obscure error generation-scenario and lacking of formalization which is the basis for the automatic error detection, exist in field of code error research. Furthermore, the automation of error detection will greatly affect the quality and efficiency of software testing. Therefore, more deeply research on code errors need to be done.<br /><br /><a href="http://www.vitabits.co.uk/mens-health" rel="nofollow">discount supplements</a>Sara Reidhttps://www.blogger.com/profile/18373862159812719999noreply@blogger.comtag:blogger.com,1999:blog-7206939994948735545.post-72163855259290150172009-11-24T17:23:28.241+02:002009-11-24T17:23:28.241+02:00"heh".reverse match {
case "heh&q..."heh".reverse match {<br /> case "heh" => "obvious?"<br />}<br /><br />this works as expected in Scala 2.8.Spiroshttps://www.blogger.com/profile/00453309074833469556noreply@blogger.comtag:blogger.com,1999:blog-7206939994948735545.post-7571254185301021222009-11-24T16:31:53.442+02:002009-11-24T16:31:53.442+02:00Have you tried scalaz's "type-safe equals...Have you tried scalaz's "type-safe equals" (===)? I haven't, but it looks promising.Adam Rabunghttps://www.blogger.com/profile/08575207879136726271noreply@blogger.com