Some informations about MotionTypes
Posted on Dec 15 2004
At my company, Motion-Twin, we no longer use ActionScript 1 or 2 to develop Flash content. We use instead Motion-Types which is our in-house made programming language. What makes MTypes more powerful than, let's say, AS2 ?
First MTypes is based on the same technology as MTASC (actually MTASC comes <em>from</em> MTypes), that means fast compilation and direct SWF generation (no need for Flash IDE).
MTypes has also several key-features that are coming from recent programming language research such as :
- polymorphism : you can write functions that operates on several types at the same time
- type inference : most of the time you don't write any type in MTypes, the types of your variables are deducted by compilation. Let's say that you write
var x = f()
. If you know the return type off
, then you can bind it tox
directly. And if you don't know it, then find it ! This way you end up writing dynamically-typed looking program while in fact all your code is correctly and strongly typed. - structural subtyping : in classical OO (most of the languages such as C++, Java, AS2 or C#) a type B is a subtype of a type A only if B
extends
orimplements
A. MTypes let you free to define your classes independently with the following rule : B is a subtype of A if all fields of A are in B (with same types). This way any class havingvar x : int, y : int
will automagically be aPoint
, no need to implements or extends Point : this makes the relation between you classes more flexible and implementation (inheritance) independent from structure (types). - anonymous functions : lambdas are powerful, function that returns functions, partial applications. If you don't know functional programming, you should have a look at it !
- first order functional types : using classical ML notation, functional types can be expressed this way :
String -> int -> bool
is a function taking one String and one int as parameters and returning one bool. - anonymous objects types : you can write the following ,
var p : { x : float, y : float, name : String };
For pure data structures, you don't need to define a type, and still everything will be correctly typed !
And even more, but most important have been said.
0 comment
-
(you)Mar 03, 2021 at 21:24