Andreas Neumann
Andreas Neumann

Reputation: 10904

Which implicit conversions in Scala are present as default when nothing is imported

Which implicits are present by default in Scala?

I know of RichString, Regex and some others I use.

Upvotes: 0

Views: 77

Answers (3)

Régis Jean-Gilles
Régis Jean-Gilles

Reputation: 32719

The automatically imported members are:

  • The members of the java.lang package
  • The members of the scala package
  • The members of the Predef object

See The scala specification §9.1

Given that only objects (and package objects) can contain methods or values, the only place where standard (with no additional import) implicit values can be found is in Predef (the scala package does not seem to have a corresponding package object at the moment).

Upvotes: 2

David Frank
David Frank

Reputation: 6092

Everything declared in Predef is imported automatically including implicits. Check Predef at http://www.scala-lang.org/api/2.10.3/index.html#scala.Predef. There you can see a list of value members. You should look for items starting with implicit def.

Upvotes: 0

vitalii
vitalii

Reputation: 3365

I believe all scala default imports are located in scala.Predef, including implicits.

Upvotes: 1

Related Questions