Am Die, 2003-03-04 um 18.52 schrieb Christopher Oliver: > Not sure. This is one of the weaknesses of JavaScript. It doesn't have > any structuring mechanism for creating libraries or reusable modules > (which was one of the things JavaScript 2.0 was supposed to fix). I > think Cocoon will have to invent its own mechanisms to describe and > manage script libraries.
the mozilla folks do many complex things in javascript, to avoid using c++ too often ;-) so perhaps they have settled on something which could be useful to cocoon here. there are some jslib things at mozdev.org. I could also imagine using SourceResolvers like in the sitemap here. Like include( 'js:/x/y/z.js' ) or import( 'js:/x/y/z.js' ) whereas import does not override existing declarations and include is just a cut'n paste of it. include and import woud simply be FunctionObjects that get bootstrapped at initialization time. they take a String as a parameter and hand this to a SourceResolver, which in turn knows how and where to load it from. just my 2 cents. btw: does anyone know if Norris Boyd or others are working on a JS 2 / EcmaScript4 Version in java - in cvs.mozilla there exists only a cpp impl of js2... -- Jakob