How to create an object like `()` in user space

In Julia, an empty tuple is a type and an instance of that type. So, isa((),())

- true

. Is it possible to create such an object yourself?

+3


source to share


1 answer


I don't believe so. In fact, Julia 0.4 is isa((),())

no longer correct. Type ()

now Tuple{}

:

julia> VERSION
v"0.4.0-dev+5441"

julia> typeof(())
Tuple{}

julia> isa((),()) # Throws an error since () is no longer considered a Type
ERROR: TypeError: isa: expected Type{T}, got Tuple{}

      



I think the only remaining objects that are the instance itself are Any

, Type

and DataType

.

+6


source







All Articles