Home

drogetype

Drogetype is a term used in theoretical discussions of programming language type systems to describe a flexible data-type concept that blends aspects of records and objects. A drogetype defines a template for values that carry both data fields and a set of associated operations, while allowing variation in structure across instances.

Core characteristics include nominal identity for each instance, structural polymorphism in the fields, and support for

Drogetypes sit between traditional records and object-oriented classes, sharing the ability to bundle data with behavior

An example in a hypothetical language might define a drogetype called Widget with fields id and version

History and usage: Drogetypes have appeared mainly in theoretical writings and language-design discussions to illustrate trade-offs

extension
through
composition
or
traits.
Instances
of
a
drogetype
may
add,
omit,
or
rename
fields
as
long
as
they
remain
compatible
with
a
declared
interface.
Behavior
can
be
provided
by
methods
attached
to
the
drogetype
or
by
external
behavioral
traits.
while
favoring
flexibility.
They
are
related
to
structural
typing,
duck
typing,
interfaces,
and
protocols,
but
are
distinguished
by
their
emphasis
on
a
reusable
template
that
can
be
extended
and
composed.
and
a
method
render.
A
drogetype
instance
may
include
additional
fields
such
as
color
while
still
conforming
to
Widget’s
interface.
Tools
for
a
drogetype
typically
support
reflection,
validation,
and
safe
serialization.
between
flexibility
and
safety.
They
are
not
a
standardized
feature
across
mainstream
languages,
and
implementations
vary
in
syntax
and
semantics.