From: <ML...@th...> - 2003-04-12 17:30:50
|
I agree I do like this syntax. However I wasn't entirely clear if you were saying that import is only for importing other scripts or if import was also going to be used to load jars into the system. If you were thinking of both I think it would make sense to have it be something like: import junit.jar as junit or import junit.pynt as junit this will help to make it more clear when looking at the build script what exactly is being imported. Mike mpf...@Th... Sent by: To: pyn...@li... pyn...@li...ur cc: ceforge.net Subject: [pynt-devel] imports 04/11/2003 05:31 PM 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? |