From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,f66d11aeda114c52 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,f66d11aeda114c52 X-Google-Attributes: gid103376,public From: Paul Johnson Subject: Re: Building blocks (Was: Design By Contract) Date: 1997/10/04 Message-ID: #1/1 X-Deja-AN: 278061580 Distribution: world X-NNTP-Posting-Host: treetop.demon.co.uk [158.152.55.135] References: <34316EC3.5B62@dynamite.com.au> <199710011402.QAA02444@basement.replay.com> <3432788C.E35@uk.ibm.com> Organization: home Newsgroups: comp.lang.ada,comp.lang.eiffel Date: 1997-10-04T00:00:00+00:00 List-Id: In article <3432788C.E35@uk.ibm.com>, Paul M Gover writes >(One of the while-loop problem is that for a tidy >record processing program you have to write > record = file.read() > Do while(~file.eof()) > thing.accept(record) > record = file.read() > End while >) I know that this was an aside, but it still puzzles me. Surely it will be wrong if the file is empty: there will be no record to read. The correct version (in Eiffel) would be from file.open("foo") until file.eof loop thing.accept (file.record) end -- loop If you have to read a dummy record before file.eof becomes valid then you have a badly designed file object. Paul. --------------------------------+--------------------------------- Paul Johnson | You are lost in a maze of twisty Email: Paul@treetop.demon.co.uk | little standards, all different. paul.johnson@gecm.com |