Truth

Truth is a type-safe domain modelling and data exchange language. It can bring domain driven design into your organization, act as an enterprise-grade alternative to JSON & YAML, or even introduce logical thinking to children.

Truth has zero built-in keywords, data types, or control flow. It starts from a blank text file, and through the layering of custom algebraic data types, a taxonomy is gradually formed, which becomes a true-to-life representation your business domain. These taxonomies, and any supposedly conforming data are automatically verified for correctness.

Truth can be used to model domains consisting of thousands, or even millions of classes—with ease.

Truth In 30 Seconds

The Truth language consists entirely of statements in the form A : B, which means A is a B. Containment (A has a C) is expressed using indentation. The indentation pattern repeats itself, allowing statements to be nested as many levels as necessary.

That's the whole language. The rest of the features are more or less natural deductions that arise from this basic fundamental.

Animal
Animal
Lobster : Animal
Number
Animal
	Weight : Number

Lobster : Animal
Number
/[0-9]+/ : Number

Animal
	Weight : Number

Lobster : Animal
Snappy : Lobster
	Weight : 1
Number
/[0-9]+/ : Number

Kg : Number
/< : Number>kg/ : Kg

Animal
	Weight : Kg
Lobster : Animal
Snappy : Lobster
	Weight : 1kg
String
/".*"/ : String

User
	Name : String
	Friends : User...

Paul : User
	Name : "Paul"
	Friends
		Kim
		Attila

Kim : User
	Name : "Kim"
	Friends
		Paul
		Attila

Attila : User
	Friends
		Paul
		Kim
String
Stapler

Employee
	Name : String

Milton : Employee
	Name : Stapler

Further Reading

It's quite shocking what can be done with a single operator. Many modern language features like Multiple Inheritance, Type Inference, Recursive Types, Dependent Types and Anonymous Types can be represented in Truth. Further information exists in our GitHub Wiki.