Home

DDtype

DDtype is a theoretical data type used in programming language research to explore the combination of dependent and dynamic typing. It provides a framework for encoding invariants that depend on values as well as on types, allowing a single construct to express both compile-time guarantees and runtime flexibility.

A DDtype value pairs a runtime value with a type index, and the accompanying type expresses a

Example: a DDtype representing a vector of length n with elements of type T would carry the

Implementation and scope: DDtype is primarily a theoretical construct but has influenced language features in dependent

Relation and further reading: Related concepts include dependent types, refinement types, multi-parameter type families, and gradual

predicate
P(index,
value).
The
index
can
be
a
natural
number,
a
shape
parameter,
or
any
dependent
parameter.
In
practice,
a
DDtype
can
encode
structures
such
as
vectors,
matrices,
or
maps
where
size,
shape,
or
key
constraints
must
hold.
If
the
index
is
not
known
at
compile
time,
runtime
checks
enforce
the
constraint.
length
n
in
its
type;
operations
must
maintain
the
invariant
that
the
resulting
vector's
length
matches
its
type
index.
When
the
index
is
unknown,
the
type
system
may
require
runtime
validation
to
preserve
safety.
type
systems
and
gradual
typing.
It
can
improve
safety
in
APIs
and
data
modeling
by
making
invariants
explicit
in
types;
however,
it
adds
complexity
and
potential
runtime
overhead
for
checks.
typing.
See
also
dependent
type,
refinement
type,
dynamic
typing,
type
safety.