tag:blogger.com,1999:blog-5089773352404981635.post1193496389701298153..comments2023-10-04T08:15:13.812-07:00Comments on Daily scala: Import Instance PropertiesAnonymoushttp://www.blogger.com/profile/07600430363435495915noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-5089773352404981635.post-78684414125845110312009-11-16T03:16:57.802-08:002009-11-16T03:16:57.802-08:00Hi, I didn't notice that. Good observation! ...Hi, I didn't notice that. Good observation! <br /><br />The method 'method2' does in fact return a Product that is not an error. If you look at the signature it is:<br /><br />java.lang.Object with ScalaObject with Product{def v1: Int; def v2: Int} = Return(6,7)<br /><br />So it is a Product{def v1: Int; def v2: Int} which declares that it has the methods v1 and v2. So when importing that object it will import v1 and v2 into the current scope.<br /><br />The type of the val cannot be Return because it is not in scope. So the compiler automatically infers Product{def v1: Int; def v2: Int} which all case classes are automatically. <br /><br />I will make a post about Products and mention the relation to case classes.Anonymoushttps://www.blogger.com/profile/07600430363435495915noreply@blogger.comtag:blogger.com,1999:blog-5089773352404981635.post-62660060246046676712009-11-14T03:44:03.209-08:002009-11-14T03:44:03.209-08:00Thanks for another very informative and useful pos...Thanks for another very informative and useful post. I love these daily tips.<br /><br />One question, in the last example method2 defines a case class called "Return" but the type shown in the interactive output is called "Product". Is this just an editing error or am I missing something?Anonymousnoreply@blogger.com