Please enable JavaScript to view this site.

A-Shell Development History

Language enhancement (compiler edit 707 + runtime): support passing DIMX arrays to functions/procedures by reference. This allows the called routine to have complete read/write/extend access to the array without the overhead of having to actually copy all the array data back and forth between the caller and called routine.

Syntax is to specify the array name with an empty pair of parentheses, both for the actual parameter being passed and for the formal parameter in the routine declaration, e.g.

dimx ARY(0),ST_CUST,auto_extend

...

call Add'Items'To'Array( ARY() )  ! pass ARY() by reference to function

...

 

procedure Add'Items'To'Array( a() as ST_CUST)    ! rcv array by reference

p = .extent( a() ) + 1

for i = p to q

a(i).field = bla     ! a() is effectively alias for passed ARY()

next i

endprocedure

 

Notes

Compiler does not currently verify that the array types for the formal and actual parameters match.
Runtime system does verify that the element sizes match.
Feature currently only supported for functions and procedures, not for subroutines.
Do not attempt to use XPUTARG to copy the array back to the caller—this makes no sense anyway.