Skip to content

Commit

Permalink
Any is equivalent to Any
Browse files Browse the repository at this point in the history
  • Loading branch information
carljm committed May 22, 2024
1 parent 9e9ebb4 commit 1271558
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions docs/spec/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,17 @@ The consistency relation

Since :ref:`Any` represents an unknown static type, it does not represent any
known single set of values, and thus it is not in the domain of the subtype,
supertype, or equivalence relations on static types described above.

We define a **materialization** relation on gradual types. The intuition for
materialization is that it transforms a "more dynamic" type to a "more static"
type. Given a gradual type ``A``, if we replace zero or more occurrences of
``Any`` in ``A`` with some gradual type (which can be different for each
occurrence of ``Any``), the resulting gradual type ``B`` is a materialization
of ``A``.
supertype, or equivalence relations on static types described above. (We do
find it convenient to say, however, that ``Any`` is both subtype and supertype
of -- that is, equivalent to -- only itself. This can allow us to simplify
redundant multiple occurrences of ``Any`` out of more complex types.)

To relate gradual types more generally, we define a **materialization**
relation. The intuition for materialization is that it transforms a "more
dynamic" type to a "more static" type. Given a gradual type ``A``, if we
replace zero or more occurrences of ``Any`` in ``A`` with some gradual type
(which can be different for each occurrence of ``Any``), the resulting gradual
type ``B`` is a materialization of ``A``.

For instance, ``tuple[int, str]`` (a static type) and ``tuple[Any, str]`` (a
gradual type) are both materializations of ``tuple[Any, Any]``. ``tuple[int,
Expand Down

0 comments on commit 1271558

Please sign in to comment.