I just wasn't sure whether when allocating for objects you have to account for
any "gubbings", just cautious I guess:
type
MyTypeA = ptr object of RootObj
x: int64
MyTypeB = ptr object of RootObj
x: array[0..4, int64]
var x0 = alloc(sizeof(int64));
var x1 = cast[MyTypeA](x0);
x1.x = 42;
echo "x: ", x1.x;
dealloc(x1); # or dealloc(x0)
var y0 = alloc(sizeof(int64)*5);
var y1 = cast[MyTypeB](y0);
y1.x = [1'i64, 2, 3, 4, 5];
echo "y1: ", y1.x;
dealloc(y1); # or dealloc(y0)
Run
I've now added your book to my Nim reading list. Thanks