scala - How to use custom predef for all files in project -


i'd shadow predef members , introduce own realization them. how can inform compiler my.own.predef._ should imported instead of scala.predef._ ?

one way i've seen done through chained package clauses.

if file @ my/own/package.scala has, example:

package package object own {   type iseq[+a] = indexedseq[a]   val iseq = indexedseq } 

then file in package my.own or subpackage of my.own automatically import iseq if came predef, if change package declaration @ top of file from

package my.own.foo 

to

package my.own package foo 

the latter form called chained package clause.

this article (which uses chained package change seq use immutable interface) seems indicate can shadow members in scala.predef way.


Comments