Re: low priority implicits for TupleConverter and TupleSetter etc.

2016-09-18 Thread Koert Kuipers
yeah agreed, it just caught me by surprise somewhat

On Sun, Sep 18, 2016 at 5:48 PM, P. Oscar Boykin 
wrote:

> 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.
> On Sun, Sep 18, 2016 at 09:32 Koert Kuipers  wrote:
>
>> 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.
>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: low priority implicits for TupleConverter and TupleSetter etc.

2016-09-18 Thread P. Oscar Boykin
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.
On Sun, Sep 18, 2016 at 09:32 Koert Kuipers  wrote:

> 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.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.