Aliasing Return Values in Methods
· I'm stuck on the concept of the return value being aliased and placed after the PUB method name.
For example:
·······
PUB Active: YesNo
· YesNo := Cog > 0
· From my understanding the return result for the PUB Active method is aliased to the variable YesNo upon exit from this method.· Does this mean that the next time that Active is called it will not execute if YesNo·was false?· What effect does placing the colon symbol and return value after the method name have?
For example:
·······
PUB Active: YesNo
· YesNo := Cog > 0
· From my understanding the return result for the PUB Active method is aliased to the variable YesNo upon exit from this method.· Does this mean that the next time that Active is called it will not execute if YesNo·was false?· What effect does placing the colon symbol and return value after the method name have?
Comments
The actual variable (either RESULT or a given name) only exists within the method and it's initialized to zero every time the method is called. It's
allocated in Spin's stack along with the return address from the method call and some other information related to the call.