Path: news.cs.au.dk!news.net.uni-c.dk!howland.erols.net!newsfeed.cwix.com!newsfeed.icl.net!colt.net!diablo.theplanet.net!skynet.be!poster!not-for-mail From: Atle Newsgroups: comp.lang.beta Subject: Re: exceptions: (atle // confused (# again #) atle) Date: Mon, 19 Jun 2000 16:02:11 -0100 Organization: Belgacom Skynet SA/NV Lines: 63 Message-ID: <394E5213.641F303F@skynet.be> References: <20000619125840.2379.qmail@noatun.mjolner.dk> NNTP-Posting-Host: dialup261.charleroi.skynet.be Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news1.skynet.be 961423048 23647 194.78.236.133 (19 Jun 2000 13:57:28 GMT) X-Complaints-To: abuse@skynet.be NNTP-Posting-Date: 19 Jun 2000 13:57:28 GMT X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.5-15 i686) X-Accept-Language: en Xref: news.cs.au.dk comp.lang.beta:12426 Sascha Kimmel wrote: > > > > returnValue := openFile('SomeFile.bet') > > IF returnValue <> OK > > THEN produceError(returnValue); > > ELSE > > { do the normal processing. > > returnValue will be a legal file handle } > > ENDIF > > Hey, I like this code :) But how well does it correspond to Beta exception handling? > > > try { > > strm = bufferedstreamandsomestuffandtotallyunreadable > (filename, OPENFLAGS); > > } > > > > catch(...) { > > cout << "The program has been somewhere and crashed" << > > " difficult to say if I should recover or what?"; > > } > > Plase put away this JAVA stuff... ;) This is an example of 'dynamic exceptions' if I have understood things right - but have I? > > > So, i know i will like the Beta way. But what way is it? > > > But I doubt that this is more intuitive than the "old" way which many > languages like Perl and PHP also use. > But object-oriented is "modern". Problem is, I don't see the difference. It looks to me as if the errors are handled 'as much as possible' inside the object, and that whatever isn't handled there is propagated back out to the calling object. But there must be more to it than that? > > The problem in BETA is: > > [...] > myfile:@file(# (..now handle the different errors...) #); > [...] > > .code... > ..more code... > .. a hundred lines of code... > > [...] > myfile.openRead; > [...] But errors are handled here, too. Like NoSuchFileError - I need to look over that again from the cat.bet example. Jørgen, could you please add more context around your code snippet, please? > > Example 1. fopen() example > > $fp = fopen("/home/rasmus/file.txt", "r"); > $fp = fopen("http://www.php.net/", "r"); > $fp = fopen("ftp://user:password@example.com/", "w"); This, however horrifies me. OK in an rc file, but not in a program! Thanks, Atle