Explicit or Implicit ?

2
Josh Suereth @jsuereth

@jorgeortiz85 Chapters 5,7 and 8 spread the suggestions around...

2011-09-01 06:42:05

数ヶ月後・・・

Jorge Ortiz @JorgeO

Why scala.collection.JavaConversions is Evil: val m: Map[Foo, Bar] = ... m.get(string) // Returns Option[Bar], right? Nope, null!

2012-01-22 10:08:28
Brandon Hudgeons @bhudgeons

@JorgeO I don't get null from that. Is your underlying Map a java.util.Map?

2012-01-22 16:38:50
Miles Sabin @milessabin

@jorgeo You must be using it typed as a java.util.Map. Can you be more specific about the problem? /cc @channingwalton @debasishg

2012-01-22 19:35:51
Jorge Ortiz @JorgeO

@seanparsons @milessabin @channingwalton @debasishg The point is that if the types are wrong (Foo != String), then you get a null.

2012-01-22 21:43:38
Miles Sabin @milessabin

@JorgeO If you have a Java Map then get can return null ... why the surprise? /cc @seanparsons @channingwalton @debasishg

2012-01-22 21:45:05
Jorge Ortiz @JorgeO

@milessabin Because I think I'm using it as a Scala map. Fuller example: https://t.co/tII5t2ck

2012-01-22 21:48:56
S @seanparsons

@JorgeO @milessabin Right, because of the implicits conversions, that makes more sense, have to admit I generally don't import all of it.

2012-01-22 21:53:13
Miles Sabin @milessabin

@JorgeO OK, gotcha. Yes, well, with the benefit of hindsight we know that those conversions were undesirable, hence JavaConverters.

2012-01-22 22:01:54
Jorge Ortiz @JorgeO

@milessabin It should go through a deprecation and removal cycle. Too many Google results still suggest JavaConversions.

2012-01-22 22:05:54
Jorge Ortiz @JorgeO

@seanparsons I generally don't import any of it (I've been bitten too many times), but people I work with don't know not to.

2012-01-22 22:06:55
S @seanparsons

@JorgeO Right, I do agree that it should be deprecated and then removed however.

2012-01-22 22:19:27