$c+
{ test of this and the @ operator for fields}
module test18

constant max = 10;
typedefinition integer range[1..max] subs;
typedefinition integer array[subs]elements;

typedefinition 
 tuple [ elements e, 
 subs t, 
 procedure push(value integer val), 
 procedure pop(reference integer val),
 procedure init()
 ] Stack;

Stack stack;

	procedure Stack@init
	begin
		this@t := 1; 
	end;
	
	procedure Stack@push
	begin
		this@e[this@t] := val;
		this@t := this@t + 1;
	end;
	
	procedure Stack@pop
	begin
		this@t := this@t - 1;
		val := this@e[this@t];
	end;
	
integer val;
private
begin
	stack!init();
	stack!push(4);
	stack!push(3);
	stack!pop(val);
	write "Just popped ", val;
	stack!pop(val);
	write "Just popped ", val;
	
end. { output:  3 4}