low priority implicits for TupleConverter and TupleSetter etc.

7 views
Skip to first unread message

Koert Kuipers

unread,
Sep 18, 2016, 3:32:33 PM9/18/16
to scaldi...@googlegroups.com
the implicits for TupleConverter and TupleSetter can lead to subtle bugs at times. i think its because of the low priority defaults for any generic type.

for example i ran into issue where an implicit wasn't propagated by mistake, and it seemed to fall back on an incorrect generic choice without any warning. it boils down to this:

scala> implicitly[TupleSetter[(String, String)]].apply(("ha", "ba")).size
res9: Int = 2

scala> def test[A] = implicitly[TupleSetter[A]]
test: [A]=> com.twitter.scalding.TupleSetter[A]

scala> test[(String, String)].apply(("ha", "ba")).size
res10: Int = 1

i wish definition of test had failed.

P. Oscar Boykin

unread,
Sep 18, 2016, 5:48:43 PM9/18/16
to Koert Kuipers, scaldi...@googlegroups.com
How can we fix this? Without having a single value be the default, lots of code won't actually work. I agree it is not the safest thing, but I don't think it can easily hit you in the TypedPipe API which is what we have recommended for years now.
--
You received this message because you are subscribed to the Google Groups "Scalding Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalding-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Koert Kuipers

unread,
Sep 18, 2016, 10:36:50 PM9/18/16
to P. Oscar Boykin, scaldi...@googlegroups.com
yeah agreed, it just caught me by surprise somewhat

To unsubscribe from this group and stop receiving emails from it, send an email to scalding-dev+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages