I am trying to write a method that should use an environment variable. The problem is that I cannot access the part of the code where the variable is defined. Something like that:
object Example extends App {
val myvar = 1.0
def myMethod()(implicit value:Double) = {
print(value)
}
myMethod()
}
This fails because it myMethodcannot find a suitable implicit for value.
is there a way to “mark” valueas implicit after it has been defined, other than defining a new implicit variable that points to value?
Reference Information. We use Spark-Notebook, where SparkContext(with a name sc) is created automatically. Since this scis a well-known name for this variable in the community, we would prefer not to enter another variable name.