comp.lang.ada
 help / color / mirror / Atom feed
* RE: WITH in Pascal
@ 1991-04-24 14:12 MARTIN%SCRANTON.BITNET
  0 siblings, 0 replies; only message in thread
From: MARTIN%SCRANTON.BITNET @ 1991-04-24 14:12 UTC (permalink / raw)


Eric Gustafson writes:

>     In the process of translating Pascal, Turbo 5.5, code to Ada, Meridan, I
>and the other members of my class group found that there was no equalivent to
>the pascal WITH statement.  After some discussion we could not think of any
>reason why the facility would cause *bad* programming practices.

The WITH allows the variable name to be significantly separated from the
operations done to its fields.  This is a bad programming practice.

>... what was the method used .. in Ada.

the aggregate assignment (ref: Cohen _Ada as a Second Language_, pp 206..):

>Example ( In Pascal ):
>..
>Type
>  PersonRec  = Record
>                 Name : String;
>                 Age  : Integer;
>                 ID   : Integer;
>               end; { PersonRec }
>..
>Var
>  Person     : PersonRec;
>..
>  WITH Person do
>  begin
>    Name := 'Asdfg';
>    Age  := 24;
>    ID   := 123930;
>  end; { with person }
>..

In Ada:
Person := (
        Name => "Asdfg",
        Age => 24,
        ID => 123930);

                ....Dennis Martin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1991-04-24 14:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-04-24 14:12 WITH in Pascal MARTIN%SCRANTON.BITNET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox