This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Re: Java interop with List and immutable Set

2 replies
Alec Zorab
Joined: 2010-05-18,
User offline. Last seen 42 years 45 weeks ago.

Ambiguous!

add(Integer.One.multiply(Integer.One.minus))

2011/12/2 √iktor Ҡlang :
>
>
> On Fri, Dec 2, 2011 at 12:36 PM, Alec Zorab
> wrote:
>>
>> No, we don't use symbolic method names here, they're confusing!
>>
>> add(1.multiply(1.minus))
>
>
> add(One.multiply(One.minus))
>
>>
>>
>> On 2 December 2011 07:55, Naftoli Gugenheim wrote:
>> > Is that +1 * -1 ?
>> >
>> >
>> > On Thu, Dec 1, 2011 at 5:20 PM, Chris Twiner
>> > wrote:
>> >>
>> >> +1 for -1
>> >>
>> >> On Dec 1, 2011 9:20 AM, "Jason Zaugg" wrote:
>> >>>
>> >>> On Thu, Dec 1, 2011 at 9:16 AM, Kevin Wright
>> >>>
>> >>> wrote:
>> >>>>
>> >>>> Many would argue "yes, JavaConversions should be deprecated".
>> >>>>  JavaConverters is a much more recent addition to the library,
>> >>>> inspired in
>> >>>> large part by scalaj-collect and prompted by a trac ticket of mine
>> >>>> concerning implicit lookup of the conversion functions.
>> >>>>
>> >>>> I've seen the occasional codebase where it looks cleaner to hide the
>> >>>> fact that you're converting[1] a collection between java and scala,
>> >>>> but this
>> >>>> is a short-sighted view.  As Martin, Josh, etc. recently stated on
>> >>>> another
>> >>>> thread, it's always far preferable to define a clear boundary between
>> >>>> pure
>> >>>> Scala and Java interop code, and to make any conversions explicit at
>> >>>> this
>> >>>> boundary.
>> >>>
>> >>>
>> >>> I (for one) still find many places where JavaConversions is perfectly
>> >>> safe and more appealing than JavaConverters. The respective Scaladoc
>> >>> does a
>> >>> good job as explaining the differences. So -1 to deprecation.
>> >>>
>> >>> -jason
>> >
>> >
>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - Enterprise-Grade Scala from the Experts
>
> Twitter: @viktorklang
>

Viktor Klang
Joined: 2008-12-17,
User offline. Last seen 1 year 27 weeks ago.
Re: Java interop with List and immutable Set


2011/12/2 Alec Zorab <aleczorab@googlemail.com>
Ambiguous!

add(Integer.One.multiply(Integer.One.minus))


Ambiguous!

Integer.add(Integer.One.multiply(Integer.One.minus))
 
2011/12/2 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> On Fri, Dec 2, 2011 at 12:36 PM, Alec Zorab <aleczorab@googlemail.com>
> wrote:
>>
>> No, we don't use symbolic method names here, they're confusing!
>>
>> add(1.multiply(1.minus))
>
>
> add(One.multiply(One.minus))
>
>>
>>
>> On 2 December 2011 07:55, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
>> > Is that +1 * -1 ?
>> >
>> >
>> > On Thu, Dec 1, 2011 at 5:20 PM, Chris Twiner <chris.twiner@gmail.com>
>> > wrote:
>> >>
>> >> +1 for -1
>> >>
>> >> On Dec 1, 2011 9:20 AM, "Jason Zaugg" <jzaugg@gmail.com> wrote:
>> >>>
>> >>> On Thu, Dec 1, 2011 at 9:16 AM, Kevin Wright
>> >>> <kev.lee.wright@gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Many would argue "yes, JavaConversions should be deprecated".
>> >>>>  JavaConverters is a much more recent addition to the library,
>> >>>> inspired in
>> >>>> large part by scalaj-collect and prompted by a trac ticket of mine
>> >>>> concerning implicit lookup of the conversion functions.
>> >>>>
>> >>>> I've seen the occasional codebase where it looks cleaner to hide the
>> >>>> fact that you're converting[1] a collection between java and scala,
>> >>>> but this
>> >>>> is a short-sighted view.  As Martin, Josh, etc. recently stated on
>> >>>> another
>> >>>> thread, it's always far preferable to define a clear boundary between
>> >>>> pure
>> >>>> Scala and Java interop code, and to make any conversions explicit at
>> >>>> this
>> >>>> boundary.
>> >>>
>> >>>
>> >>> I (for one) still find many places where JavaConversions is perfectly
>> >>> safe and more appealing than JavaConverters. The respective Scaladoc
>> >>> does a
>> >>> good job as explaining the differences. So -1 to deprecation.
>> >>>
>> >>> -jason
>> >
>> >
>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - Enterprise-Grade Scala from the Experts
>
> Twitter: @viktorklang
>



--
Viktor Klang

Akka Tech LeadTypesafe - Enterprise-Grade Scala from the Experts

Twitter: @viktorklang
Chris Twiner
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Java interop with List and immutable Set

Thanks guys that's much better. I just tried to read what I wrote and found it too complex to understand.

That operator overloading really harmed the readability. I also could not  trust the context, my intuition, the compiler or any tests to see what it meant.

I think the scope details for add etc really add weight to business logic, I truly believe its fit for the enterprise now.

On Dec 2, 2011 12:53 PM, "√iktor Ҡlang" <viktor.klang@gmail.com> wrote:


2011/12/2 Alec Zorab <aleczorab@googlemail.com>
Ambiguous!

add(Integer.One.multiply(Integer.One.minus))


Ambiguous!

Integer.add(Integer.One.multiply(Integer.One.minus))
 
2011/12/2 √iktor Ҡlang <viktor.klang@gmail.com>:
>
>
> On Fri, Dec 2, 2011 at 12:36 PM, Alec Zorab <aleczorab@googlemail.com>
> wrote:
>>
>> No, we don't use symbolic method names here, they're confusing!
>>
>> add(1.multiply(1.minus))
>
>
> add(One.multiply(One.minus))
>
>>
>>
>> On 2 December 2011 07:55, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
>> > Is that +1 * -1 ?
>> >
>> >
>> > On Thu, Dec 1, 2011 at 5:20 PM, Chris Twiner <chris.twiner@gmail.com>
>> > wrote:
>> >>
>> >> +1 for -1
>> >>
>> >> On Dec 1, 2011 9:20 AM, "Jason Zaugg" <jzaugg@gmail.com> wrote:
>> >>>
>> >>> On Thu, Dec 1, 2011 at 9:16 AM, Kevin Wright
>> >>> <kev.lee.wright@gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> Many would argue "yes, JavaConversions should be deprecated".
>> >>>>  JavaConverters is a much more recent addition to the library,
>> >>>> inspired in
>> >>>> large part by scalaj-collect and prompted by a trac ticket of mine
>> >>>> concerning implicit lookup of the conversion functions.
>> >>>>
>> >>>> I've seen the occasional codebase where it looks cleaner to hide the
>> >>>> fact that you're converting[1] a collection between java and scala,
>> >>>> but this
>> >>>> is a short-sighted view.  As Martin, Josh, etc. recently stated on
>> >>>> another
>> >>>> thread, it's always far preferable to define a clear boundary between
>> >>>> pure
>> >>>> Scala and Java interop code, and to make any conversions explicit at
>> >>>> this
>> >>>> boundary.
>> >>>
>> >>>
>> >>> I (for one) still find many places where JavaConversions is perfectly
>> >>> safe and more appealing than JavaConverters. The respective Scaladoc
>> >>> does a
>> >>> good job as explaining the differences. So -1 to deprecation.
>> >>>
>> >>> -jason
>> >
>> >
>
>
>
>
> --
> Viktor Klang
>
> Akka Tech Lead
> Typesafe - Enterprise-Grade Scala from the Experts
>
> Twitter: @viktorklang
>



--
Viktor Klang

Akka Tech LeadTypesafe - Enterprise-Grade Scala from the Experts

Twitter: @viktorklang

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland