Record fields / Array elements as VAR parameters

Topics related to the use of Oberon language features
Locked
kevinhely
Posts: 29
Joined: Wed May 18, 2011 3:35 am

Record fields / Array elements as VAR parameters

Post by kevinhely » Wed Jan 09, 2013 5:26 pm

Can a field (or array element) be an argument corresponding to a VAR parameter, i.e. are fields and array elements considered "variables"?

cfbsoftware
Site Admin
Posts: 493
Joined: Fri Dec 31, 2010 12:30 pm
Contact:

Re: Comparing pointers (including extensions)

Post by cfbsoftware » Sat Jan 12, 2013 11:45 pm

The current version of Astrobe allows this. Do you have any reason to believe it should not?

kevinhely
Posts: 29
Joined: Wed May 18, 2011 3:35 am

Re: Record fields / Array elements as VAR parameters

Post by kevinhely » Sun Jan 13, 2013 2:55 am

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.)

Locked