Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!munnari.oz.au!comp.vuw.ac.nz!canterbury!cctr132 From: cctr132@csc.canterbury.ac.nz (Nick FitzGerald, CSC, Uni. of Canterbury, NZ) Newsgroups: comp.lang.pascal Subject: Re: string ghosts Message-ID: <1991Feb28.180622.137@csc.canterbury.ac.nz> Date: 28 Feb 91 05:18:17 GMT References: <26159@adm.brl.mil> Organization: University of Canterbury, Christchurch, New Zealand Lines: 42 In article <26159@adm.brl.mil>, STANKULI%UWF.BITNET@cunyvm.cuny.edu ( stan kulikowski ii) writes: > (* > 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... > *) > >[demo code deleted] > > (* > is this the way pascal is supposed to run? Dunno. Are strings part of standard Pascal?? - They seem to be implemented in so many different ways I always assumed the answer (to my question) was "No". > 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 >[stuff deleted] What's Fregean logic got to do with compiler implementation? 8-) > am i missing something important here? this is elementary logic which > was worked out in the 1920's. Is it relevant to programming, as opposed to "natural", languages? I though it was common knowledge that nulling a string in TP simply reset the index byte (AnyString(0)) to zero, and that to actually null out the contents you had to do that "manually". That is: AnyString:=''; is equivalent to AnyString(0):=char(0); not to for I:=length(AnyString) down to 0 do AnyString(I):=char(0); Nick.