Quésoft microsystèmes
Specifications of the Moka language.

Preambule

The Moka object oriented language has been developed by Quésoft microsystèmes with the goal to give an object oriented alternative to the C language on TI-89 and TI-92Plus calculators.  In fact, while C is somewhat convivial and that excellent IDE exists, the object oriented programming is not supported.  Moka was designed from the ground up to be a pure object oriented language and comes to fill this gap.

History of the Quésoft microsystèmes' object oriented languages

It is the development of user graphic interfaces that encouraged Quésoft microsystèmes to develop object oriented languages.  The first available solution was Texas Instruments Basic Object Oriented Language (TIBOOL), a superset of TI Basic which takes a definitive form only from release 2.  Quésoft then released Hippic Challenge, a game that featured a graphic user interface programmed in TIBOOL.  While the esthetic result of TIBOOL programs was satisfying, the speed was lacking.

Then Quésoft microsystèmes developed the New Object Oriented Language (NOOL) to cure the problem.  NOOL brings many improvements over TIBOOL.  First, as it used the CLib (and FLib at the begining) for the drawing functions, the display speed was for the first time acceptable. Second, NOOL was closer to the object oriented paradigm than TIBOOL and it's code was more efficient.  But, as NOOL remains a superset of the TI Basic language, the execution speed remains deceiving.  Quésoft microsystèmes then takes a historic decision : the abandonment of the TI Basic language for the C language.

After, the C Object Oriented Language (COOL) was designed.  COOL being a superset of the C language, the COOL programs was native ones thus rapid and efficient ones.  But it become clear that COOL would never be as close to the object oriented paradigm as NOOL.   It is the reason why, even before the release of COOL, Quésoft microsystèmes worked on Moka, the first pure native and convivial object oriented language for calculator.

What is Moka ?

Moka is an object oriented language that permit to develop native applications for TI-89 and TI-92Plus.  Moka is a language, a syntax and a converter, but isn't a really a compiler.  In fact Moka translate a object oriented language syntax in a compiled language.  Actually, the compiled code is in C.  Precisely, the Moka code is converted in Enhenced COOL (Enhenced C Object Oriented Language) then compiled with TIGCC. The Moka syntax is realy near the Java.  If fact, so near that one can generate the javadoc of a Moka program.

Moka vs Java
Moka uses the same keywords than Java.  But Moka features are less complete than Java :
- No Garbage Collector. The garbage collection feature (implemented via the
moka.lang.Use_GarbageCollection interface) is very limited.
- No multi-thread. However a related functionnality has been implemented. See moka.event.Interrupt for details.
- Limited polymorphism.  Static polymorphism management :
In a 100% pure OO language, the polymorphism is dynamically treated when the program runs.  For example, in Java, if a reference to an Object is used as parameter with a method that exist in two forms, one that require an Object and the other a String and that the object reveal to be a String, the method that require a String will be called.
    Object o = new String(); //o is a reference to an Object, but this object is a String.
    System.out.print(o);//public void System.out.print(String s) will be called.
In Moka an EXPLICITE CAST is needed to call the method using a String, because the resolution of the exact nature of an object is done staticly, when the program is compiled.
    Object o = new String();
    //System.print(o);//public void System.print(Object o); will be called.
    System.print((String)o);//public void System.print(String s); will be called.
- No distinction between float type and double type.
- Arrays are not implemented as objects, their manipulation is conform to the C language manipulation of arrays.
- The Strings aren't copied while the assignation :
In java, the operation (s1 == s2, or "is s1 the same object than s2") evaluated the following operations returns false, in Moka, it returns true :
    String s1 = "salut"; //Declare a String s1 pointing to the newly allocated String with a value of "salut"
    String s2; //Declare a String s2
    s2 = s1; //Assign s1 to s2
NB: Many methods accepting String finalize the String object used before returning.  It is necessary to use a copy of the String object if the String is to be use later.
    String s = "salut";
//Declare a String s pointing to a newly allocated String with the value "salut"
    System.out.print(s.toString());//The toString method of the String class returns a copy of the String
- The Moka API contains a very limited number of the Java's API classes.  Moreover, these classes are implemented in a different manner, and while everything have been done to make them the closer to their Java counterpart, they differ appreciably and are, most of the time, less complete.  For example, the print method, implemented with the out object of the System class in Java, is a static function of the System class in Moka.
    System.out.print("salut");//In Java, display the String "salut" on the screen
    System.print("salut");///In Moka, display the String "salut" on the screen
- In Java, the "import" instruction permit to use a class without specifying it's package.  In Moka, the "import" instruction add the code of a class in the program, permitting to use it, but increasing sinificantly the size of the program.
- In Moka all the class of the main directory are included in the project.
- In Java, the classes of the "java.lang" package are dirrectly accessible, event if the programmer hasn't included the "java.lang" package.  In Moka, the classes of the "moka.lang" package need to be explicitly imported before they can be used.
- In Java, the "native" keyword is used only with a method, and signify that the method is implemented elsewhere, in a compiled language.  In Moka, it signify that the method contains code that should not be converted.  The native blocks (native {}) and the natives instructions (native () or native.instruction()) are also supported in Moka.
    public native void outp () {//Native method, the content will not be converted.
        printf("salut");
    }
    public void outp () {//
Stantard method, the content will be converted.
        native { //Native block, the content will not be converted.
            printf("salut");
        }
    }
    public void outp () {//Stantard method, the content will be converted.
            if (true)
                native ( printf("salut") );
//Native instruction, will be converted.
    }

Moka's types

Moka
C equivalent
C memory length
boolean
BOOL
16 unsigned
char
char
8 signed
float
float
80-bit
double
double
80-bit
byte
byte*
8 signed
short
short int
16 signed
int
long int
32 signed
long
long long int
64 signed

* : byte is defined #define byte char

The packages
moka.lang : 
Hold the basic classes of the language, as System, String and Object.
moka.util : Hold the utility classes, as comme Vector, StringTokenizer and Timer.
moka.io : Hold the classes that encapsulates the Input-Output operations, as File, Socket and Serializable.
moka.event : Hold the classes linked to the event-driven programming, as Event and Interupt.
moka.x : Hold the graphic environment classes as GEM (The Graphic Environment Manager) and Frame.