Type alias

Two different types may have the same "simple name", i.e., the portion after the last . separator. We can't import both such types with import statements, because using its simple name is ambiguous as to which type it referes to. Therefore, we will be forced to use their full UTLs in code. For example, both meso:meso.lang.Object and java:java.lang.Object have the same simple name Object:

namespace meso:;

public class Foo {

   public static void main(string[] args) {

       meso:meso.lang.Object o1 = new meso:meso.lang.Object();
       java:java.lang.Object o2 = new java:java.lang.Object();

       // ...
   }
}

However, using full UTL in so many places in code is cumbersome and ugly. One may use type aliases to solve this problem. An imported UTL can be assigned with an alias. The alias is only valid within the scope of the source file. Just put the alias right after the UTL in an import statement, as followings:

namespace meso:;
import meso:meso.lang.Object Mo;        // Mo is a type alias
import java:java.lang.Object Jo;        // Jo is a type alias

public class Foo {

   public static void main(string[] args) {

       Mo o1 = new Mo();
       Jo o2 = new Jo();

       // ...
   }
}

Type aliases should only be used when it can dramatically improve the readability of source code. Overusing it might make the code looks more confusing, because the data type an alias represents might not be immediately obvious to the reader.