A Pliant pointer is not like a C pointer but rather like a C++ reference which you can modify using :> operator.

The following listing:

module "/pliant/language/unsafe.pli"
gvar Int i
gvar Pointer:Int j
gvar Pointer:Int k
j :> i
j := 2
k :> j
k := j

is equivalent to the C code:

int i ; 
int *j ; 
j = &i ; 
*j = 2 ; 
k = j ; 
*k = *j ; 

As you see, in Pliant, pointers are automatically dereferenced. When you want to set the pointer, you use the :>  operator.
So, j :> i should be read: 'j' now points 'i'

Last example:

module "/pliant/language/unsafe.pli"
gvar Int i
gvar Pointer:Int j
gvar (Pointer Pointer:Int) k
k :>> j
k :> i
k := 2

is equivalent to the C code:

int i ; 
int *j ; 
int **k ; 
k=&j ; 
*k=&i ; 
**k=2 ; 


An address is a data that stores the address of another data. It can be compared to the void *  C data type.
Let's take a look at another example:

module "/pliant/language/unsafe.pli"
gvar Int i
gvar Address a
a := addressof i
gvar Pointer:Int j
j :> a map Address

The example demonstrates how to switch between Address  data type and pointers.

function addressof data -> adr
  arg Universal data ; arg Address adr

returns the address of the data.

method adr map type -> data
  arg Address adr ; arg_RW type data

The type must be constant (known at compile time).

method base_address translate type count -> translated_address
  arg address base_address ; arg Type type ; arg Int count ; arg Address translated_address

Computes 'translated_address' by adding 'count' times 'type' size to 'base_address'


Links are just like pointers, but they automatically update the reference count of the pointed object and free the object when its reference count falls to 0.As result, the pointed data must be either a global variable or an object created by new function.
Let's take an example:

module "/pliant/language/unsafe.pli"
gvar Link:Int i
gvar Int g  # a global variable
i :> new Int
i := 2
i :> g

The last instruction will free the object created through calling new since nothing is pointing to it anymore.

Extra rules about links:

method new type -> data
  arg Type type ; arg_RW type data

creates a new data (with an header that contains a pointer to the type of the data and a reference count) and returns a pointer to it.

method new type value -> data
  arg Type type ; arg type value ; arg_RW type data

creates a new data, sets it's value and returns a pointer to it.


An Arrow is to links what an Address is to pointers.
It contains an address, but automatically updates the reference count of the target object (and eventually frees it if it falls to 0) when the address changes.