Why implicitConversions is required for implicit defs but not classes?

Implicit classes effectively only add new methods (or traits), and they are only ever used when these added methods are called (or the implicit class is used explicitly, but this rarely happens in practice). Implicit conversions to existing types, on the other hand, can be invoked with less visibility to the programmer.

Scala streaming library differences (Reactive Streams/Iteratee/RxScala/Scalaz…)

PS: I wonder why Play Iteratees library has not been choosed by Martin Odersky for his course since Play is in the Typesafe stack. Does it mean Martin prefers RxScala over Play Iteratees? I’ll answer this. The decision of which streaming API’s to push/teach is not one that has been made just by Martin, but … Read more

What does Scala’s “try” mean without either a catch or finally block?

Scala’s exception handling works by passing any exceptions to an anonymous catch function. The catch function works by pattern matching the caught exception and, if it doesn’t match it will pass the exception up. The catch function is optional, if it’s omitted then the exception is passed straight up. So essentially try { exceptionThrowingFunction() } … Read more

Can I do Aspect Oriented Programming in Scala?

Mixin has been the classic way to introduce AOP in Scala (as in “AOP-style Mixin Composition Stacks in Scala” from Jonas BonĂ©r). But I know only of “Method Proxy-Based AOP in Scala” (Daniel Spiewak — also here on SO — and Tian Zhao) as an advanced AOP implementation in Scala (source code here). Our technique … Read more

Spark 2.0 Dataset vs DataFrame

Difference between df.select(“foo”) and df.select($”foo”) is signature. The former one takes at least one String, the later one zero or more Columns. There is no practical difference beyond that. myDataSet.map(foo.someVal) type checks, but as any Dataset operation uses RDD of objects, and compared to DataFrame operations, there is a significant overhead. Let’s take a look … Read more

Overriding Scala Enumeration Value

The Enumeration values are instance of the Val class. This class can be extended and a factory method can be added. object My extends Enumeration { val A = Value(“name”, “x”) val B = Value(“other”, “y”) class MyVal(name: String, val x : String) extends Val(nextId, name) protected final def Value(name: String, x : String): MyVal … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)