[comp.lang.ada] Gustafson's Pascal with

bryan@SIERRA.STANFORD.EDU (Doug L. Bryan) (04/24/91)

>Date: 4 Feb 91

Wow.  The BITNET seems pretty slow lately.

>From: Eric Gustafson <ece490%VALPO.BITNET@UICVM.uic.edu>
>Subject: An equilivant to Pascal's WITH in Ada??
>Message-ID: <9104210400.AA06564@ajpo.sei.cmu.edu>

>Example ( In Pascal ):
>..
>Type
>  PersonRec  = Record
>                 Name : String;
>                 Age  : Integer;
>                 ID   : Integer;
>               end; { PersonRec }

I'm not sure how you plan to handle strings, so I'll ignore then
in my example.

-- Ada
type Person_Rec is record
    Age  : Integer;
    ID   : Integer;
  end record;

>  WITH Person do
>  begin
>    Age  := 24;
>    ID   := 123930;
>  end; { with person }

-- Ada
With_Person: declare
  Age : Integer renames Person.Age;
  ID  : Integer renames Person.ID;
begin
  Age := 24;
  ID  := 123930;
end With_Person;

doug