|
From: <mpf...@Th...> - 2003-04-11 16:31:10
|
I'm trying to think of a way to have the "import" statement work across
multiple pynt scripts, was wondering what you thought about this idea.
What I'd like to do is have something like this:
import ant
ant.javac.debug = true
ant.javac.optimize = false
...etc...
So when "ant" gets imported, a single object gets returned and assigned to
the "ant" variable. This object has inner objects for each of the ant
tasks. Pynt would also make sure that "ant" only gets imported once. This
avoids name collisions and allows us to resovle references imported
targets correctly.
For example, let's say I want to compile junit, antlr, and pynt, where
antlr depends on junit, and pynt depends on both:
* junit.pynt *
target compile:
...
* antlr.pynt *
import junit
target compile:
build junit.compile
...
* pynt.pynt *
import junit
import antlr
target compile:
build junit.compile, antlr,compile
...
In this case, junit.pynt would only get run once, even though it is
imported twice. You can think of each pynt script as defining a singleton
object, and the imports simply create a reference to that singleton. We
would need to set up some sort of PYNTPATH to tell pynt where to look for
the imported scripts (ie "import junit" would look for "junit.pynt", or
maybe for a jar file called "junit.par" or something).
thoughts? |