Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pucc-i Path: utzoo!linus!philabs!cmcl2!seismo!harvard!talcott!panda!genrad!decvax!harpo!whuxlm!whuxl!houxm!ihnp4!inuxc!pur-ee!CS-Mordred!Pucc-H:Pucc-I:ags From: ags@pucc-i (Dave Seaman) Newsgroups: net.micro Subject: Re: Turbo PASCAL quirk? Message-ID: <922@pucc-i> Date: Thu, 21-Feb-85 14:46:21 EST Article-I.D.: pucc-i.922 Posted: Thu Feb 21 14:46:21 1985 Date-Received: Sun, 24-Feb-85 02:47:04 EST References: <513@intelca.UUCP> Distribution: net Organization: Purdue University Computing Center Lines: 44 > What happens is that the line Sym_List := Nxt_Ident has no effect since > the With statement seems to lock you into the VALUE of the Sym_List > pointer when you enter the With statement. Is this standard PASCAL? > I assumed, obviously incorrectly, that this code is equivalent to the > same code without the With and with all of the record fields prefixed > with Sym_List^. The implementation is correct. According to the American Pascal Standard, The record-variable shall be accessed before the statement of the with-statement is executed, and that access shall establish a reference to the variable during the entire execution of the statement of the with-statement. The line Sym_List := Nxt_Ident does indeed have an effect (it changes the value of Sym_List), but it does not affect the record-variable access which is effective for the entire duration of the with-statement. By the way, underscores in identifiers are not standard Pascal. > Type > Ident_Ptr = ^Ident; > Ident = Record > Name : String[127]; > ID_Type : Ident_Type; > References : Line_Ref; > Nxt_Ident : Ident_Ptr; > End; > Var > Sym_List : Ident_Ptr; > > ... > > With Sym_List^ Do > Begin > While Name <> '' do > Begin > Writeln(Name); > Print_References(References); > Sym_List := Nxt_Ident; > End; (* While *) > End; (* With *) -- Dave Seaman ..!pur-ee!pucc-i:ags