Path: utzoo!mnetor!uunet!portal!cup.portal.com!R_Tim_Coslet From: R_Tim_Coslet@cup.portal.com Newsgroups: comp.lang.pascal Subject: Re: Scope question Message-ID: <4228@cup.portal.com> Date: 31 Mar 88 05:12:26 GMT References: <718@virginia.acc.virginia.edu> Organization: The Portal System (TM) Lines: 38 XPortal-User-Id: 1.1001.4086 Steve Losen scl@virginia.edu University of Virginia Academic Computing Center Writes: >The following pascal program compiles and outputs "10" with the Berkeley >pascal compiler "pc". [.... deleted text ....] >As far as I can tell, then, the pascal fragment > >const c = c; > >should not be allowed even if c is a constant defined in an enclosing >block. Is my interpretation of the pascal standard correct? Since I'm >writing a pascal compiler, I need to have this issue cleared up. > >A further note: > > The Berkeley pascal compiler also accepts fragments like this: > >type thing = array [1..10] of thing; { where "thing" is a type defined > in an enclosing block } > >This also appears to be illegal according to the ISO pascal standard. > >Does anyone out there agree/disagree/care? I definitely agree that the above examples are potentially ambigious... I tend to agree with your interpretation of the ISO standard... However I don't know as it makes alot of difference, as such code does not seem to have any useful purpose (perhaps you could suggest one). When compiled by a compiler meeting the ISO standard as you have discribed it, the compiler should probably flag such lines as: Error - Self Referential Declaration, unable to determine value. Hmm... interesting idea: Self Referential Declarations... :-)