tag:blogger.com,1999:blog-5089773352404981635.post6632214550299821274..comments2023-10-04T08:15:13.812-07:00Comments on Daily scala: Type aliasing and implicit conversions in harmonyAnonymoushttp://www.blogger.com/profile/07600430363435495915noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-5089773352404981635.post-88142290669776060262012-08-28T20:36:25.431-07:002012-08-28T20:36:25.431-07:00I wouldn't necessarily call this type inferenc...I wouldn't necessarily call this type inferencing. As far as I understand implicit conversions. Since 5 is not of type Either[Int|String], it will look for implicits before aborting with a compile error. It will find the that the only implicit which takes in the right argument (both in this case) and the produces the correct type is makeLeft (because makeRight would produce Either[String|Int], not Either[Int, String]. Symetrically for any String argument in the Array constructor.<br /><br />There is absolutely not ambiguity as far as I am concerned and this all naturally occurs from following the simple implicit conversion rules, I wouldn't exactly consider this behaviour to be type inferencing.<br /><br />Nice post btw, do any of you have any ideas on why makeLeft and makeRight are not part of "language.implicitConversions"?Anonymoushttps://www.blogger.com/profile/00751585791727692408noreply@blogger.comtag:blogger.com,1999:blog-5089773352404981635.post-54962570122128575582009-11-23T12:35:30.861-08:002009-11-23T12:35:30.861-08:00The information that determines if the value is a ...The information that determines if the value is a Left or a Right is inferred from the Array type signature: Array[Int | String] the type inferencer is able to determine that the string is the Right and vice versa. Pretty powerful.Anonymoushttps://www.blogger.com/profile/07600430363435495915noreply@blogger.comtag:blogger.com,1999:blog-5089773352404981635.post-78180925124976482142009-11-23T04:59:13.930-08:002009-11-23T04:59:13.930-08:00I do wonder why the makeLeft and makeRight implici...I do wonder why the makeLeft and makeRight implicits did not cause an ambiguity error. After all, what's to say Int is the left and String is the right?Danielhttps://www.blogger.com/profile/07505997833685327219noreply@blogger.com