is possible use scala's import
without specifying main function in object, , without using package
keyword in source file code wish import?
some explanation: in python, can define functions in file "lib.py", write
from lib import *
in other file "run.py" in same directory, use functions lib in run, , run run command python run.py
. workflow ideal small scripts might write in hour.
in scala, appears if want include functions file, need start wrapping things in superfluous objects. rather not this.
writing python in scala unlikely yield satisfactory results. objects not "superfluous" -- it's program not written in object oriented way.
first, methods must inside objects. can place them inside package object
, , they'll visible else inside package of same name.
second, if 1 considers solely objects , classes, package-less objects , classes class files present in classpath, or scala files compiled together, visible each other.
Comments
Post a Comment