« Home » « Learn » « Download » « Github »

logo

Cello High Level C

Methods

ref

void ref(var self, var item);

Set the object self to reference the object item.

deref

var deref(var self);

Get the object referenced by self.

Examples

Usage

var obj0 = $F(1.0), obj1 = $F(2.0);
var r = $(Ref, obj0);
show(r);
show(deref(r)); /* 1.0 */
ref(r, obj1);
show(deref(r)); /* 2.0 */
assign(r, obj0);
show(deref(r)); /* 1.0 */

Pointer


Reference to other object

The Pointer class is implemented by types which act as references to other objects. Primarily this class is implemented by Ref and Box which provide the two main pointer types in Cello.

Definition

struct Pointer {
  void (*ref)(var, var);
  var (*deref)(var);
};

Implementers

  • Box |     Unique Pointer
  • Ref |     Shared Pointer

Back