January 2020
Intermediate to advanced
532 pages
13h 31m
English
Let's first take a look at a simple example for a composite type for tracking the coordinates of a point:
struct Point x yend
When the field type is not specified, it is implicitly interpreted as Any, the super type of all types, hence the preceding code is syntactically equivalent to the following (except that we have renamed the type name as Point2 to avoid confusion):
struct Point2 x::Any y::Anyend
The fields x and y have the Any type, meaning that they can be anything: Int64, Float64, or any other data type. To compare the memory layout and utilization, it is worth creating a new point type that uses a small concrete type, such as UInt8:
struct Point3 x::UInt8 y::UInt8end
As we know, ...
Read now
Unlock full access