Typing - xkp/Doc GitHub Wiki

xs is hybrid-typed, everything (properties, variables, parameters) has a type. It just happens that sometimes such types are unknown or variant.

The language introduces the keyword var as a type. Its completely coincidental the fact that you can write:

var i = 0;

Since the variable declaration in xs is strictly the same as java, c#, et al:

<Local Var Decl> ::= <Type> Identifier 
                 |   <Type> Identifier '=' <Expression>

Type inference

Whenever is possible xs will deduct types for you, in a statement such as the above the variable i will be of type "int".

Dynamic typing

The language provide operators to deal with variants: as, is, has

⚠️ **GitHub.com Fallback** ⚠️