Home

Basetypes

Basetypes, or base types, are the fundamental, non-composite types provided by a programming language or type system. They are defined directly by the language specification rather than in terms of other types, and they serve as the primitive building blocks from which more complex types are constructed.

Key characteristics of basetypes include their fixed representation and well-defined operations. They typically include numeric types

In most type systems, other types are built from basetypes using type constructors or aggregations. For example,

Different languages may vary in what they count as a basetype. Some treat strings as primitive basetypes,

(such
as
integers
and
floating-point
numbers),
boolean,
character,
and
sometimes
string
or
date/time
types,
depending
on
the
language.
Basetypes
usually
support
a
core
set
of
operations
(arithmetic,
comparison,
conversion)
and
play
a
central
role
in
ensuring
type
safety,
since
many
rules
about
how
values
can
be
used
and
combined
are
specified
for
these
primitive
kinds.
arrays,
records,
tuples,
functions,
and
generic
types
are
formed
by
combining
basetypes
or
other
types.
The
relationship
between
basetypes
and
derived
types
often
includes
rules
about
subtyping,
promotion
or
coercion,
and
nullability.
Basetypes
often
have
concrete
memory
representations,
which
informs
performance
and
optimization
decisions
in
a
compiler
or
runtime.
while
others
implement
strings
as
derived
types
built
from
characters.
Some
languages
also
differentiate
unsigned
and
signed
numeric
basetypes,
or
expose
additional
primitives
for
dates,
times,
or
pointers.
Across
domains,
the
term
basetype
generally
denotes
the
core,
lowest-level
types
that
underpin
a
language’s
type
system.