Types and Void

The hierarchy of type system in Skila will be similar to Scala or C# — Object as root, and then each type inherits from the other (single-/multi-inheritance, traits, and so on — another time). I didn’t yet decided about Nothing from Scala.

Unlike C# Object provides nothing — there is no forcing developer to implement ToString (no every type has to have textual representation) or GetHashCode (not every type has to be prepared to be put in collection or even compared).

Another deviation from those two languages is “no type” type — Void. It is single type outside entire hierarchy, it has only one value — void, so for example you can write:

fun hello() : Void =
  return void;

Omitting void (value) here is valid.

The reason for introducing such “no type” is annoying dichotomy in C# libraries — Func and Action come to mind first. The only reason for having two distinct families is the fact Action does not return anything (i.e. it returns void) and Func returns something. This is not an issue with Skila – you can use:


(function with parameter of type Int, and returning some type T). If T is Void (type) then… so what? it is good type as any other.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: