Search code examples
scalaimportimplicit

Scala, import with lower priority?


Is it possible to import an object with lower priority? that means, if a conflict exist, reference to its members will be discarded.

I only know that for an object I wrote I can move part of its members to a LowPriority trait, but I don't know if it is possible to do this for any class.


Solution

  • Not. I can't understand why you would want to do that. If there are conflicts you can rename your imports. Very simple explanation: http://blog.bruchez.name/2012/06/scala-tip-import-renames.html

    Also, about imports, check root imports: http://www.scala-lang.org/old/faq/3.html#3n260