These are chat archives for chipsenkbeil/groupchat

22nd
Mar 2016
Chip Senkbeil
@chipsenkbeil
Mar 22 2016 15:43
Other than the fact that an implicit class can take one non-implicit value as a constructor argument, are there any advantages/disadvantages to using implicit methods that convert to wrapper classes as opposed to using implicit classes?
I'd like the option to be something like this...
import org.scaladebugger.api.dsl._
val s: ScalaVirtualMachine = _

// Now implicitly added, normal method is getOrCreateBreakpointRequest(...)
s.forBreakpoint(...)
import org.scaladebugger.api.dsl.BreakpointDSL
val s: ScalaVirtualMachine = _

// Does same thing as other DSL implicit
s.forBreakpoint(...)
I would prefer not to stick a ton of implicit classes in one file (package object).
So, if I could create individual files for BreakpointDSL and others, I would be happy.
But I would need to stick into the package object implicit methods to convert to the wrapper classes.
Chip Senkbeil
@chipsenkbeil
Mar 22 2016 15:48
And I couldn't have the methods the same name as the classes, so that would flood the namespace when you want to import.
So, that's an advantage for implicit classes, I guess.
FYI, I'm converting to more standard names with the option of importing a DSL because some of the ways I'm using the api in Ensime don't make as much sense when you break up the method chain.
E.g.
// Looks weird by itself
val b = s.forBreakpoint(...)

// Looks better by itself (even though verbose) and explains what is going on
val b = s.getOrCreateBreakpointRequest(...)

// In another file
b.map(...).foreach(...)