Skip to content
Phil Paradis edited this page Sep 18, 2016 · 4 revisions

It might be a good idea (or not) to use a strongly typed system (similar to typing systems from many functional programming languages).

Basically, one would need by defining a set of basic "Types" from which literally anything in the world derives.

NULL --> {Type, Entity, Action}

Then, a few basic types come pre-defined, but the user can always define new types or redefine existing types. The types form a hierarchy, which would include, for example, at least the following:

Type -> {Integer, String, Real, Enum, Color, Feeling, List, ...}  
Entity -> {Person, Animal, ...}  
Action -> {Jump, Say, Explain, Ask, ...}

Let a = 5 be an integer. Then a has type Integer. Integer has type Type. Type has type NULL.

Let b = Phil be me, the user, a Person. Then b has type User. User has type Person. Person has type Entity. Entity has type Object. Object has type NULL.

There are both pros and cons to having a strongly-typed system.

For example, one could define a Sentence as a String. Then a Conversation could be 3-tuple of (Person a, Person b, List of Pairs (Person, Sentence)). The system would inherit all information known about the existing types Person (i.e. it has a Name and an Entity associated with it) and String (a basic data type).

Multiple versus Single inheritence

This hierarchy of types can use multiple or single inheritence.

For example: The type Sentence could inherit from both Person and String.

Alternatively, the type Sentence could inherit only from String and add Person as a new attribute (for the user who spoke the sentence).

Examples

It would be useful to look at many examples of programming languages that have implemented this concept. Some of them are type-free dynamic scope languages (See Common Lisp or Smalltalk) with multiple inheritence. Others have a strongly-enforced type system with multiple inhereitance (see Galileo and OBJ).