Date: Sat, 26 Jul 2025 11:50:33 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: READ-LINE when u1=0 Newsgroups: comp.lang.forth References: <68839b81$1@news.ausics.net> <2025Jul25.170641@mips.complang.tuwien.ac.at> Content-Language: en-GB From: dxf In-Reply-To: <2025Jul25.170641@mips.complang.tuwien.ac.at> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: news.ausics.net Message-ID: <6884346a$1@news.ausics.net> Organization: Ausics - https://newsgroups.ausics.net Lines: 78 X-Complaints: abuse@ausics.net Path: news.eternal-september.org!eternal-september.org!feeder3.eternal-september.org!news.bbs.nz!news.ausics.net!not-for-mail On 26/07/2025 1:06 am, Anton Ertl wrote: > dxf writes: >> Ambiguous condition? If not, what should be the result > > AFAICS u1=0 is not specified as ambiguous condition, and I don't see > a reason that would make it ambiguous. > > The results depend on the state of the file. > > 1) Either a non-zero ior, or > 2) ior=0, u2=0, and > a) flag=false under the specified condition > b) flag=true otherwise > >> and what is it good for? > > If you ever meet programmers that call READ-LINE with u1=0, ask them. > > The last time I asked about a usage that appeared pointless to me (an > empty DOES> clause), the author had no satisfying explanation. If not ambiguous then the result should be exactly predictable. If the result differs but with no harmful effect then what would you call that? 0 value fid : print cr rot 2 .r ." ->" swap 2 .r 3 .r ; : test s" foo.txt" r/w create-file throw to fid s" foobar" fid write-file throw fid close-file drop s" foo.txt" r/o open-file throw to fid page 0 pad over fid read-line throw print 10 pad over fid read-line throw print 0 pad over fid read-line throw print 1 pad over fid read-line throw print fid close-file drop cr ; test \\ SwiftForth 0 -> 0 -1 10 -> 6 -1 0 -> 0 0 1 -> 0 0 VFX 0 -> 0 -1 10 -> 6 -1 0 -> 0 -1 1 -> 0 0 Gforth 0 -> 0 -1 10 -> 6 -1 0 -> 0 -1 1 -> 0 0 NTF 0 -> 0 -1 10 -> 6 -1 0 -> 0 -1 1 -> 0 0 Win32Forth 0 -> 0 -1 10 -> 6 -1 0 -> 0 0 1 -> 0 0