Based on the doc,
Ptr{T} is
A memory address referring to data of type T. However, there is no guarantee that the memory is actually valid, or
that it actually represents data of the specified type.
From the other hand :
Ref{T}
An object that safely references data of type T. This type is guaranteed to point to valid, Julia-allocated memory
of the correct type. The underlying data is protected from freeing by the garbage collector as long as the Ref
itself is referenced.
So my question is : Ref seems have the same use cases than Ptr and seems better than Ptr in any cases. Is there some rules on when should we use Ptr{T} instead of Ref{T} ?