I would like to propose to include in gpc the "tagging feature for with statements" as found in (the now obsolete) Sun Pascal.
Example:
program WithTag;
type Rec = record i: integer; r: real; ... end;
var c, d, e: char; a: array [ char, char ] of Rec;
begin readln ( c, d, e ) ; with a [ UpCase(c), d ] : x, a [ succ(d), e ] : y do begin ; y.r := sqrt ( x.i ) ; ... end { with } end.
This way, you introduce shorthand names (the tags) for records. This is especially interesting when these records are of the same type (as in the example above), or when the records share field names (because then the records cannot be distinguished on the basis of the field name only).
The addresses of the records in the with statement are determined once (and associated with the tag). This cannot easily be accomplished otherwise in general, especially when the records are big, and the address involves some "expensive" address calculation (indexing in multiple dimensions).
When records are small, you can copy the contents to a local record variable; otherwise, you have to use explicit pointers, or work with an auxiliary procedure and parameters:
procedure WithTwoRec ( const x, y: Rec ); begin ; y.r := sqrt ( x.i ) ; ... end;
begin readln ( c, d, e ) ; WithTwoRec ( a [ UpCase(c), d ], a [ succ(d), e ] ) end.
Cheers,
Tom Verhoeff