Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!njin!princeton!udel!haven!adm!news From: STANKULI%UWF.BITNET@cunyvm.cuny.edu ( stan kulikowski ii) Newsgroups: comp.lang.pascal Subject: string ghosts Message-ID: <26159@adm.brl.mil> Date: 27 Feb 91 22:58:10 GMT Sender: news@adm.brl.mil Lines: 58 (* i was having some strange behavior in one of my TP 5.5 programs... a string variable was behaving as if it still had the contents of previous assignments after it had been nulled. even the turbo debugger saw that the string had null value, but it still operated as if the ghost of its previous assignment was still there... *) program STRING_CHECK; var ANY_STRING : string; begin (* Main Program *) ANY_STRING := 'OK'; ANY_STRING := ''; writeln; writeln ('ANY_STRING is "',ANY_STRING,'"'); if (ANY_STRING 1! = 'O') and (ANY_STRING 2! = 'K') then writeln (' Uhoh.... string contents still there| ') else writeln (' Whew... string is gone. '); writeln (ANY_STRING 1!, ANY_STRING 2!); end. (* is this the way pascal is supposed to run? if so, this is very counterintuitive. when i null out a string, i obviously intend that all of its contents should be likewise null. surely any reference to a zero-length null string returns nil value. my understanding of fregean compositionality requires that if the value of any language structure is nil then any of its parts should also be nil else the value of the whole is not based on the values of its parts. am i missing something important here? this is elementary logic which was worked out in the 1920's. stan . stankuli@UWF.bitnet === close your eyes, my darling, or three of them at least --- -- old venusian lullaby *)