0

I have this code in Oz:

declare
fun {NewCounter}
C Bump Read in
C={NewCell 0}
fun {Bump}
C:=@C+1
@C
end
fun {Read}
@C
end
counter(bump:Bump read:Read)
end

I have two questions:

1) C, Bump and Read labels are declared after the NewCounter function. Are they global labels ?

2) The NewCounter function return the record counter. Why do I have to specify the name of the record (counter), considering that no other function will never explicitly invoke it?

Jhdoe
  • 101
  • 1

1 Answers1

0

C, Bump and Read are local variables (part of the NewCounter function).

The label of the returned record is probably not important here. But client code could use the label. Also it can be useful to see in the debugger.

wmeyer
  • 3,426
  • 1
  • 18
  • 26