Julia instantiation concept

Viewed 51

I have been reading the Julia Documentation, and also some blogs on the internet, and I have found sentences that mention the concept of instantiation, for instance, "Int64 can be instantiated". I found some information on this concept here:

https://www.computerhope.com/jargon/i/instantiation.htm

but I cannot see how this could be used in Julia or why it is relevant. Any comment would be welcome. Thanks.

1 Answers

We say that type can be instantiated if it is possible to create an object that has this type.

For example Int64 can be instantiated as e.g. 1 on a 64-bit machine by default has this type:

julia> typeof(1)
Int64

However, a supertype of Int64 is Signed:

julia> supertype(Int64)
Signed

The Signed type cannot be instantiated, because it is abstract (see https://docs.julialang.org/en/v1/manual/types/#man-abstract-types). This means that it is impossible to create an object that has type Signed.

Related