Table of Contents

Interface ITypes<TLinkAddress>

Namespace
Foundation.Data.Doublets.Cli
Assembly
Foundation.Data.Doublets.Cli.dll

A type hierarchy kept in the links themselves (issue #148):

  • the type of a link is its source: (v: S x) is a value of type S;
  • a type points at itself: the root (Type: Type Type) is a point and a sub-type of T is (S: T S), a value of T whose target is itself;
  • more parents (multiple inheritance) are pairs (p: S T2) marked by (m: Extends p).

So Type -> SubType -> … -> Value is a chain of sources of any depth.

public interface ITypes<TLinkAddress> where TLinkAddress : struct, IUnsignedNumber<TLinkAddress>

Type Parameters

TLinkAddress

Properties

Extends

The Extends marker, or the null link when there is none.

TLinkAddress Extends { get; }

Property Value

TLinkAddress

Root

The root type, (Type: Type Type).

TLinkAddress Root { get; }

Property Value

TLinkAddress

Methods

AncestorsOf(TLinkAddress)

Every type type is, itself first, breadth first, without repeats.

IReadOnlyList<TLinkAddress> AncestorsOf(TLinkAddress type)

Parameters

type TLinkAddress

Returns

IReadOnlyList<TLinkAddress>

Define(TLinkAddress, params TLinkAddress[])

Defines a type (S: parent S) that also extends every type in more.

TLinkAddress Define(TLinkAddress parent, params TLinkAddress[] more)

Parameters

parent TLinkAddress
more TLinkAddress[]

Returns

TLinkAddress

Extend(TLinkAddress, TLinkAddress)

Makes type extend parent: the pair (p: type parent) marked by (m: Extends p). Returns the pair. Refused when parent is a direct sub-type (parent: type parent) of type, whose definition is that very doublet.

TLinkAddress Extend(TLinkAddress type, TLinkAddress parent)

Parameters

type TLinkAddress
parent TLinkAddress

Returns

TLinkAddress

Instance(TLinkAddress)

A value (v: type v) of type.

TLinkAddress Instance(TLinkAddress type)

Parameters

type TLinkAddress

Returns

TLinkAddress

Instance(TLinkAddress, TLinkAddress)

A value (v: type target) of type.

TLinkAddress Instance(TLinkAddress type, TLinkAddress target)

Parameters

type TLinkAddress
target TLinkAddress

Returns

TLinkAddress

IsA(IList<TLinkAddress>, TLinkAddress)

IsA(TLinkAddress, TLinkAddress) for a link given as (index, source, target), stored or not.

bool IsA(IList<TLinkAddress> link, TLinkAddress type)

Parameters

link IList<TLinkAddress>
type TLinkAddress

Returns

bool

IsA(TLinkAddress, TLinkAddress)

Whether link is type itself or of it.

bool IsA(TLinkAddress link, TLinkAddress type)

Parameters

link TLinkAddress
type TLinkAddress

Returns

bool

IsExtension(TLinkAddress)

Whether link is a pair that gives a type one more parent.

bool IsExtension(TLinkAddress link)

Parameters

link TLinkAddress

Returns

bool

IsOf(IList<TLinkAddress>, TLinkAddress)

IsOf(TLinkAddress, TLinkAddress) for a link given as (index, source, target), stored or not.

bool IsOf(IList<TLinkAddress> link, TLinkAddress type)

Parameters

link IList<TLinkAddress>
type TLinkAddress

Returns

bool

IsOf(TLinkAddress, TLinkAddress)

Whether link is strictly of type: starting from its source and the types the link itself extends, through any depth of sub-types and parents, cycles included. A type is not of itself; IsA(TLinkAddress, TLinkAddress) is.

bool IsOf(TLinkAddress link, TLinkAddress type)

Parameters

link TLinkAddress
type TLinkAddress

Returns

bool

IsType(TLinkAddress)

Whether link is a type: it exists and points at itself.

bool IsType(TLinkAddress link)

Parameters

link TLinkAddress

Returns

bool

ParentsOf(TLinkAddress)

The direct parents of a type: its source (unless it is a point) and what it extends.

IReadOnlyList<TLinkAddress> ParentsOf(TLinkAddress type)

Parameters

type TLinkAddress

Returns

IReadOnlyList<TLinkAddress>

TypeOf(TLinkAddress)

The type of a link: its source; the null link for a missing link.

TLinkAddress TypeOf(TLinkAddress link)

Parameters

link TLinkAddress

Returns

TLinkAddress