Path: news.cs.au.dk!not-for-mail From: "Jorgen Lindskov Knudsen" Newsgroups: comp.lang.beta Subject: Re: Program 'betcat.bet': Comments, please? Date: Tue, 20 Jun 2000 23:06:39 +0200 Organization: University of Aarhus, Department of Computer Science (DAIMI) Lines: 67 Message-ID: <8iomd0$a60i$1@xinwen.cs.au.dk> References: <394D2663.37AB97D4@skynet.be> <394F9A74.3AB6FE7D@skynet.be> NNTP-Posting-Host: isdn-002.cs.au.dk X-Trace: xinwen.cs.au.dk 961535200 333842 255.255.255.255 (20 Jun 2000 21:06:40 GMT) X-Complaints-To: news@cs.au.dk NNTP-Posting-Date: 20 Jun 2000 21:06:40 GMT X-Newsreader: Microsoft Outlook Express 4.72.3155.0 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Xref: news.cs.au.dk comp.lang.beta:12465 Apart from the indentation (which is a personal matter :-), the style is just fine. Regards, Jørgen Atle wrote in message <394F9A74.3AB6FE7D@skynet.be>... >Now, I have gotten my betcat.bet program to work, it terminates gracefully when there is noSuchFile, and correctly cats the contents >to the screen. > >My request now is just for comments on style, errors that don't show up easily, anything you can think of that I should know about. > >I don't want to be developing bad habits when starting with a new language. > >betcat.bet is given below. >Thanks, Atle > > >ORIGIN '~beta/basiclib/betaenv'; >INCLUDE '~beta/basiclib/file'; > >-- Program : Descriptor -- > >(# > i : @integer; > showFile : > (# > OK : @Boolean; > fileName: ^text; > fil: @File (# > accessError:: (# do false -> OK #); > noSuchFileError:: (# do true ->continue ; false -> OK #); > otherError:: (# do false -> OK #) > #); > enter fileName[] > do > TRUE -> OK; > > fileName[] -> fil.Name; > fil.openRead; > (if not OK then > 'Can\'t open file ' -> putText; fileName[] -> putLine; > leave showFile > else > 'Contents of ' -> putText; fileName[] -> putLine; > if); > readTheFile: > (# > do (if not fil.eos > then > fil.getline -> putLine; > restart readTheFile > else > fil.Close; '' -> fil.Name; > leave readTheFile > if); > #); > #) > > do (for i:noOfArguments-1 repeat i+1 -> arguments -> showFile for) >#)