Any

Language-level Alias - var

Any is the type in Julian language to provide an expereince for non-typed system.

Any cannot be instantiated directly, but a variable of Any can always be assigned from variables of any other types, including Object and primitive types such as int. Wherever type checking is performed, such as in the cases of paramters, Any is always treated as a match.

Any can also be used as the element type of Array:

var v1 = new var[]{ "a", 1, null };
var v2 = new var[5];
var v3 = new var[2][3];


An array value can be assigned to an Any variable. Then one can use is operator to check if the variable is actually an Array.

var v = new MyClass[5];
v is Array; // true
v is MyClass[]; // true
v is Object[]; // false - array doesn't support covariance


Similarly, an Any variable of Array type can be cast to Array or the concrete array type. But casting to an array of the element's ancestor type, or even Any type, would fail since Julian doesn't support type covariance.

var v = new MyClass[5];
MyClass[] v1 = (MyClass[])v; // success
var[] v2 = (var[])v; // throws