Index

Docstrings for the TypeParameterAccessors.jl public API.

Contents

Index

Type parameter interface

TypeParameterAccessors.positionFunction
position(type::Type, position_name)::Position

An optional interface function. Defining this allows accessing a parameter at the defined position using the position_name.

For example, defining TypeParameterAccessors.position(::Type{<:MyType}, ::typeof(eltype)) = Position(1) allows accessing the first type parameter with type_parameters(MyType(...), eltype), in addition to the standard type_parameters(MyType(...), 1) or type_parameters(MyType(...), Position(1)).

source
TypeParameterAccessors.PositionType
struct Position{P} end

Singleton type to statically represent the type-parameter position. This is meant for internal use as a Val-like structure to improve type-inference.

source
TypeParameterAccessors.type_parametersFunction
type_parameters(type_or_obj, [pos])

Return a tuple containing the type parameters of a given type or object. Optionally you can specify a position to just get the parameter for that position, or a tuple of positions to get a subset of parameters.

Errors if parameters are unspecified. For an unchecked version, see get_type_parameters.

source
TypeParameterAccessors.get_type_parametersFunction
get_type_parameters(type_or_obj, [pos])

Return a tuple containing the type parameters of a given type or object. Optionally you can specify a position to just get the parameter for that position, or a tuple of positions to get a subset of parameters.

If parameters are unspecified, returns a TypeVar. For a checked version, see type_parameters.

source
TypeParameterAccessors.default_type_parametersFunction
default_type_parameters(type::Type)::Tuple

An optional interface function. Defining this allows filling type parameters of the specified type with default values.

This function should output a Tuple of the default values, with exactly one for each type parameter slot of the type.

source
TypeParameterAccessors.set_type_parametersFunction
set_type_parameters(type::Type, positions::Tuple, parameters::Tuple)
set_type_parameters(type::Type, position, parameter)

Return a new type where the type parameters at the given positions are set to the provided values.

source
TypeParameterAccessors.specify_type_parametersFunction
specify_type_parameters(type::Type, positions::Tuple, parameters::Tuple)
specify_type_parameters(type::Type, position, parameter)

Return a new type where the type parameters at the given positions are set to the provided values, only if they were previously unspecified.

source

Array-type tools