Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!goblin1!goblin.stu.neva.ru!postnews.google.com!gc3g2000vbb.googlegroups.com!not-for-mail From: Paul Cager Newsgroups: comp.lang.java.programmer Subject: Re: Call by Result Date: Fri, 17 Jun 2011 02:38:34 -0700 (PDT) Organization: http://groups.google.com Lines: 17 Message-ID: <67cda338-2802-40fa-a8e5-fcd1fe8ca5e0@gc3g2000vbb.googlegroups.com> References: NNTP-Posting-Host: 81.94.213.9 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1308303590 12524 127.0.0.1 (17 Jun 2011 09:39:50 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 17 Jun 2011 09:39:50 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: gc3g2000vbb.googlegroups.com; posting-host=81.94.213.9; posting-account=VsWLXwoAAAB13M2Ptt5-Bo-K_zCx-zyw User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-Header-Order: HNKRUAELSC X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.65 Safari/534.24,gzip(gfe) Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5340 On Jun 16, 3:30=A0pm, Cholo Lennon wrote: > IMHO using exceptions is not always the best answer to this problem (as > other suggested). > Not always, no. But in this case there are hints that the OP regarded the lack of a String as an error condition - he used phrases such as "mean failure" and "DidItWork". In that case I think an exception is appropriate (and less work than many of the other suggestions!). I believe that cases where neither of the following two options are appropriate are relatively rare: - returning null, meaning the "thing" was not found, but that's only to be expected. - throwing an exception, meaning that you can't return anything because an error happened.