AbstractUnitRange{<:Integer}
has been replaced byAbstractRange{<:Integer}
as the elligible type for specifying an array axis. This is a trait forAbstractUnitRange{<:Integer}
. Methodsas_array_axis
,as_array_axes
andas_array_shape
convert index ranges toAbstractUnitRange{Int}
throwing an exception if any range does not have unit step. The downside is that this must be explictely checked for non-AbstractUnitRange{<:Integer}
ranges.
-
Non-exported type
TypeUtils.Unsupported
may be used to provide a fallback implementation of a method for given types of arguments that is only supported when some extension is loaded. -
new_array(T, inds...)
creates an array with elements of typeT
and shape defined byinds...
. The returned array is anOffsetArray{T}
ifinds...
contains any index range other thanBase.OneTo
and anArray{T}
otherwise. In the former case, an exception is thrown if the packageOffsetArrays
has not been loaded.
Add a few types and methods related to array size and axes:
-
ArrayAxis = AbstractUnitRange{eltype(Dims)}
is an alias to the possible canonical types representing a single array index range. -
ArrayAxes{N} = NTuple{N,ArrayAxis}
is an alias to the possible canonical types representingN
-dimensional array axes. -
ArrayShape{N}
is an alias to theN
-tuple of array dimensions and/or index ranges to whichas_array_shape
,as_array_size
, oras_array_axes
are applicable. -
as_array_shape
converts its argument(s) to canonical array axes or to canonical array size. -
as_array_axes
converts its argument(s) to canonical array axes, that is aN
-tuple of typeArrayAxes{N}
.as_array_axis
converts its argument to a single array axis of typeArrayAxis
. -
as_array_size
converts its argument(s) to a canonical array size, that is aN
-tuple of typeDims{N}
.as_array_dim
converts its argument to a single array dimension length of typeeltype(Dims)
.
-
to_same_type(x...)
is a substitute topromote(x...)
that warrants that returned instances have the same type and that callsas(T,x)
, notconvert(T,x)
, if any conversion is needed. -
to_same_concrete_type(T...)
is a substitute topromote_type(T...)
that throws an exception if typesT...
cannot be promoted to a common concrete type.
convert_eltype
can be applied to a number.
- All methods and types formerly provided by
Unitless
are now provided byTypeUtils
which supersedesUnitless
.
TwoDimensional
is no longer an extension becauseTwoDimensional
version 0.5 directly extendsconvert
as expected byTypeUtils
.
- Method
as_return(T, f)
builds an instance ofTypeStableFunction{T}
which is a sub-type ofAbstractTypeStableFunction{T}
. These two types are both exported.
- Methods
destructure
,destructure!
, andrestructure
are inline.
- Methods
destructure
,destructure!
,restructure
, andstruct_length
can deal with tuples.
-
New methods
vals = destructure(obj)
ordestructure!(vals, obj)
, andobj = restructure(T, vals)
to destructure and objectobj
as a tuple or vector of its values and, conversely, to rebuild an object of typeT
from its values. -
New method
struct_length
yields the number of values needed to destructure an object.
-
Fix
convert_eltype(T,A)
whenA
is a range. -
parameterless
is now implemented asconstructorof
inConstructionBase
.
convert_eltype(T,A)
yields a tuple ifA
is a tuple.
convert_eltype(T,A)
yields a range ifA
is a range.
This is the first version as an official Julia package.
- Fix a typo causing
as_return
to fail when applied to anAsReturn
object.
-
New method
as_return(T, f)
yields a callable object that behaves likef
when called as a function except that it lazily converts the value returned byf
to typeT
. -
New method
return_type(f, argtypes...)
to infer the type of the result returned by the callable objectf
when called with arguments of typesargtypes...
.
-
New method
promote_eltype(args...)
to yield the promoted element type ofargs...
. -
New method
convert_eltype(T,A)
to convert the element type ofA
to beT
. -
New method
as_eltype(T,A)
to lazily convert the element type ofA
to beT
.
-
Method
parameterless(T)
to get the typeT
without parameter specifications. For example:julia> parameterless(Vector{Float32}) Array
-
Methods
as(T,x)
to convertx
to typeT
. -
Call
f = as(T)
to build a callable object such thatf(x)
is the same asas(T,x)
. -
Extension for
TwoDimensonal
. -
Package was previously named
AsType
andCastType
.