Page 1 of 1

Record fields / Array elements as VAR parameters

Posted: Wed Jan 09, 2013 5:26 pm
by kevinhely
Can a field (or array element) be an argument corresponding to a VAR parameter, i.e. are fields and array elements considered "variables"?

Re: Comparing pointers (including extensions)

Posted: Sat Jan 12, 2013 11:45 pm
by cfbsoftware
The current version of Astrobe allows this. Do you have any reason to believe it should not?

Re: Record fields / Array elements as VAR parameters

Posted: Sun Jan 13, 2013 2:55 am
by kevinhely
No. This is addressed by a section (9.2) on procedure call that I'd forgotten about:
In the case of variable parameters, the actual parameter must be a designator denoting a variable. If it designates an element of a structured variable, the selector is evaluated when the formal/actual parameter substitution takes place, i.e. before the execution of the procedure.
I have a slight difficulty with the fact that parameters are discussed in two separate sections of the spec. (It's not the only place this happens: assignment to procedure variables is described in the section on procedure types (6.5) rather than the section on assignment (9.1), and NEW is defined in (6.4) on pointer types rather than (10.2) on predefined procedures.)