On this page:
2.1.1 Nominal v.s. Structural Types
2.1.2 Struct-Based Types and Struct Type Properties
2.1.3 Type Implementations and Generativity
2.1.4 Defining Types
2.1.5 Compile-Time Type Information

2.1 Interfaces Common to All Types

The rebellion/type module is broken down into a collection of modules, such as rebellion/type/record and rebellion/type/tuple. Each module is meant for working with a specific kind of data type. However, all of these modules have a few things in common.

2.1.1 Nominal v.s. Structural Types

Any type created in rebellion/type is a nominal type, not a structural type. This means creating a new type, such as with define-record-type, creates a new named unique type that is distinct from all other types. The functions created by one use of define-record-type will not work on instances created via another use of define-record-type, even if both types are named the same and have exactly the same fields.

2.1.2 Struct-Based Types and Struct Type Properties

All types are created using Racket structure types, and the created struct types can have structure type properties attached to them. Each module typically provides default structure type properties for the types it creates, based on how its types are typically used. These defaults can be freely overriden when desired.

2.1.3 Type Implementations and Generativity

The structure, or shape of a type is distinct from an implementation of that type. Each rebellion/type module reflects this distinction by providing two different interfaces for shapes and implementations. A rebellion/type module for working with kind types provides:

A kind descriptor can be created for a type using the make-kind-implementation function provided by the corresponding rebellion/type/kind module. Multiple calls to such a function with the same type will produce distinct implementations that are not equal? to each other, meaning that the rebellion/type modules create generative types.

2.1.4 Defining Types

Each rebellion/type/kind module provides a define-kind-type form that creates a new type and binds its constructor, predicate, and accessors to variables. These forms are how most users of the rebellion/type modules are expected to create types, similar to how most Racket struct types are created with the struct form rather than the dynamic make-struct-type function.

2.1.5 Compile-Time Type Information

At present, no means of representing compile-time information about types is provided. As a result various related features, such as integration with match are not provided by any rebellion/type modules. However, both a basic represention of compile-time type information and integration with match are intended to happen eventually. More advanced functionality such as a full static type system and compile-time type checker are out of scope for now, but it is hoped that such an effort can either build on or integrate with this library.