Difference between revisions of "Extensible Object Script"
(→Examples) |
(→Examples) |
||
Line 120: | Line 120: | ||
return fib(n-1) + fib(n-2); | return fib(n-1) + fib(n-2); | ||
} | } | ||
+ | </shl> | ||
+ | <shl> | ||
+ | // Objects and Object-Mixing | ||
+ | function Color() | ||
+ | { | ||
+ | public function setRGB( r, g, b ) | ||
+ | { | ||
+ | // ... | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function Shape() | ||
+ | { | ||
+ | // ... | ||
+ | } | ||
+ | |||
+ | function Square() extends Shape() | ||
+ | { | ||
+ | public function setSize( w, h ) | ||
+ | { | ||
+ | // ... | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* derived class created using mixins: | ||
+ | */ | ||
+ | |||
+ | function ColoredSquare() | ||
+ | { | ||
+ | mixin new Square(); | ||
+ | mixin new Color(); | ||
+ | } | ||
+ | |||
+ | var coloredSquare = new ColoredSquare(); | ||
+ | coloredSquare.setRGB( 0xff, 0xff, 0xff ); | ||
+ | coloredSquare.setSize( 25, 50 ); | ||
+ | |||
</shl> | </shl> |
Revision as of 04:58, 27 December 2022
Extensible Object Script | |
---|---|
Developer | Netroda Technologies, A. Zeneli et. al. |
Type | Scripting Language |
Licenses | Public Domain |
Initial release |
Dec. 1998 |
Current Version | 2.4 |
Platform | EOSRuntime (Java / Platform Independent) |
Origin |
|
Typing | Dynamic, Weak |
Influences | Java, ActionScript, JavaScript |
Extensible Object Script (short "EOS") is the Scripting language used for Systems Based on the Extensible Services / Server for Automation family. Extensible Object Script features Object mixing, caching, lambda expressions and strict/weak typing.
Extensible Object Script runs inside the ES/S-A Enviroment (Java-Based) and is compatble with Java Object (Objects extending java.lang.Object). As Java-Based Language (Processed by JJ and Apache BCEL) it is theoretically Plattform independent, as the runtime can be executed on any Java-capable platform.
Examples
// A Simple While-Loop var a = 0; while(true) { a++; if( a > 5 ) break; else continue; a = 10; // this line is never evaluated }
// Two For-Loops var arr = []; for( var i=0; i<10; i++ ) arr[i] = i; var sum = 0; for( var item : arr ) sum += item;
// Simple Recursion function fib(n) { if( n == 0 ) throw new Exception("Invalid Input"); else if( n == 1 ) return 1; else if( n == 2 ) return 1; else return fib(n-1) + fib(n-2); }
// Objects and Object-Mixing function Color() { public function setRGB( r, g, b ) { // ... } } function Shape() { // ... } function Square() extends Shape() { public function setSize( w, h ) { // ... } } /* derived class created using mixins: */ function ColoredSquare() { mixin new Square(); mixin new Color(); } var coloredSquare = new ColoredSquare(); coloredSquare.setRGB( 0xff, 0xff, 0xff ); coloredSquare.setSize( 25, 50 );