tag:blogger.com,1999:blog-5984257377700763372.post6309071638998603291..comments2015-11-05T04:05:33.133-08:00Comments on Just another braindump: Typed approach for object ids in ScalaAnonymoushttp://www.blogger.com/profile/03465397748695796109noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5984257377700763372.post-44264838644746101162015-11-05T04:05:33.133-08:002015-11-05T04:05:33.133-08:00Quite inspiring post @Nick! I really liked the way...Quite inspiring post @Nick! I really liked the way you implemented Id[T]. That being said, I believe the problem that you described in mess.scala is due to undeterministic order of the parameters. In order to avoid similar problems, I encourage everyone (including myself) to always use named parameters.<br /><br />Let me put it this way:<br /><br />case class Foo(id: Id[Foo], name: String = "Default")<br />Foo(genId, "Luke") // ok<br /><br />case class Foo(id: Id[Foo], surname: String = null, name: String = "Default")<br />Foo(genId, "Luke") // not ok<br /><br />Per see, now you need to define Name[Foo] and Surname[Foo] types as well. And this list goes on. IMHO, the optimal approach to this problem is to always stick with named parameters instead.Anonymoushttps://www.blogger.com/profile/10946631855054644282noreply@blogger.com