Questions tagged [predef]
9 questions
9
votes
1 answer
Scala Predef unimport
Possible Duplicate:
How to unimport String “+” operator in Scala?
So things from Predef get automatically imported into scala programs. But how can I disable- unimport certain or all imported functions from Predef? As an example if I don't like…

AndreasScheinert
- 1,918
- 12
- 18
6
votes
1 answer
Scala package object vs Predef
What's the difference between something being defined in the scala package object and in Predef?
Is Predef just a relic from pre-2.8 when package objects didn't exist, or is there some other reason why we need both?

Luigi Plinge
- 50,650
- 20
- 113
- 180
3
votes
1 answer
Scala: How to always make certain utils available to sub packages?
All my code is under package com.company.project. In almost all of my files, I end up importing some common things like import scala.util.{Failure, Try, Success} and import scala.util.control.NonFatal etc. Is it possible to somehow setup a package…

pathikrit
- 32,469
- 37
- 142
- 221
3
votes
1 answer
Explain why import scala.Predef.String fails build
I found very strange issue with Scala import.
I wrote sample class:
package test_scala_predef
object App extends App {
classOf[T]
println( "Hello World!" )
}
class T {
}
This class compiles without any errors.
But, if I add
import…

uthark
- 5,333
- 2
- 43
- 59
2
votes
1 answer
Changing imports that are always in scope in Intellij
In my Scala project I decided to change predefined imports. By default compiler puts:
import java.lang._
import scala._
import scala.Predef._
into scope, but that can be controlled with compiler flags. And that's what I am curious about - is there…

Mateusz Kubuszok
- 24,995
- 4
- 42
- 64
1
vote
2 answers
Flattening scala.immutable.Seq with -Yno-predef flag
I am using custom Predef with -Yno-predef flag. It is basically a copy of SlamData's one.
When I try to flatten nested immutable Seqs collections I receive error:
No implicit view available from my.Predef.Seq[String] =>…

Mateusz Kubuszok
- 24,995
- 4
- 42
- 64
1
vote
1 answer
Rabbit Hole: found String, required java.lang.String
Hit a really strange issue today while trying to add an implicit method to Either.
implicit class EitherProvidesRollback[String,B](e: Either[String,B]) {
def rollback(
ss: Option[Session], overrideMsg: Option[String]): Either[String,B] = {
…

virtualeyes
- 11,147
- 6
- 56
- 91
1
vote
0 answers
Does PyDEV predefined support parameters type?
I have a function like this:
def get_entity(entity_class, entity_id):
"get an entity by given entity id
@type entity_class: type
@type entity_id: long
@rtype: entity_class
"
return entity_class.get(entity_id)
I wrote a…

lifei
- 235
- 2
- 10
0
votes
1 answer
Force scala.Predef initialization on application start without affecting the code
Initialization of scala.Predef class is lazy heavyweight operation which may cause unexpected slowdown of application and will become a trouble in situations when timing matters (like programming contests).
val a = new Array[Integer](10)
a(5) = 3…

FireFry
- 125
- 6