ExtendScript / JavaScript implementation - Classes???
Posted: May 25th, 2007, 2:43 am
Being a Java coder at heart, I really want to be able to use classes, constructors etc. in my scripts. I don't mind if I do this by using JavaScript 2.0 features e.g.
http://www.mozilla.org/js/language/js20 ... asses.html
Or by something like the importPackage()and importClass() functions, that are supposedly in ECMAScript, as suggested here:
http://osdir.com/ml/text.xml.batik.user ... 00053.html
However, neither of these work! I have used the ability to emulate some OOP functionality just treating function() as a class definition and using 'this.' for instance variables... but, man, isn't there a better way to do it?? After coming from a strongly typed coding environment, I lose track of things doing it that way, and it just feels plain nasty.
If there are any decent solutions to this, I'd be very grateful to hear them.
Thanks,
Chris
http://www.mozilla.org/js/language/js20 ... asses.html
Or by something like the importPackage()and importClass() functions, that are supposedly in ECMAScript, as suggested here:
http://osdir.com/ml/text.xml.batik.user ... 00053.html
However, neither of these work! I have used the ability to emulate some OOP functionality just treating function() as a class definition and using 'this.' for instance variables... but, man, isn't there a better way to do it?? After coming from a strongly typed coding environment, I lose track of things doing it that way, and it just feels plain nasty.
If there are any decent solutions to this, I'd be very grateful to hear them.
Thanks,
Chris