Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cwjcc!gatech!ncsuvx!lll-winken!arisia!sgi!shinobu!odin!rhialto!andru From: andru@rhialto.sgi.com (Andrew Myers) Newsgroups: comp.lang.pascal Subject: Re: Standard Pascal Message-ID: <203@odin.SGI.COM> Date: 12 Jul 89 18:28:07 GMT References: <8736@pyr.gatech.EDU> Sender: news@odin.SGI.COM Distribution: usa Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 52 In article <8736@pyr.gatech.EDU> gus@pyr.gatech.EDU (gus Baird) writes: > >> >> I don't see how this differs at all from >> >> repeat >> read( input, ch); >> until not (ch in [space, tab, newline, cr, formfeed]); > >No! There's a TREMENDOUS difference between > > repeat > read(FileVar,ch) > until ch {is whatever}; > >and > > while FileVar^ {is not whatever} do > get(input); > >far beyond the trivial savings of a local variable. > >The point is that that the version with read consumes the character >that stops the loop. ... This is true. Nonetheless, the difference isn't as great as you seem to think. What's really happening here? Pascal is giving you a one-record buffer that you can inspect without advancing the file pointer. However, we can implement this easily enough in Turbo's paradigm, by introducing a buffer variable tied to FileVar: reset(FileVar) -> reset(FileVar); read(FileVar,FileVarP); get(FileVar) -> read(FileVar,FileVarP); FileVar^ -> FileVarP If you're so inclined, you can bundle the file and the variable as fields of a record, and implement some alternate I/O routines that give you the abstraction. I've converted a number of programs from Standard Pascal to Turbo using this approach, and it works fine. Now, I agree with everyone else that Borland should not have changed the semantics of Pascal, but arguing purely from a standpoint of the language, it's a tossup. I certainly wouldn't pay anything for the file window abstraction. -Andrew >-- >gus Baird