Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news.mixmin.net!newsfeed.utanet.at!newscore.univie.ac.at!aconews-feed.univie.ac.at!aconews.univie.ac.at!not-for-mail Newsgroups: comp.lang.java.programmer From: Andreas Leitgeb Subject: Re: Call by Result References: <95e4uuF3cvU1@mid.individual.net> <8CtIp.4644$PA5.4578@newsfe01.iad> <4df5290c$0$49183$e4fe514c@news.xs4all.nl> Reply-To: avl@logic.at User-Agent: slrn/pre0.9.9-111 (Linux) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: Date: 14 Jun 2011 10:52:41 GMT Lines: 28 NNTP-Posting-Host: gamma.logic.tuwien.ac.at X-Trace: 1308048761 tunews.univie.ac.at 5640 128.130.175.3 X-Complaints-To: abuse@tuwien.ac.at Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:5300 Silvio wrote: > Well, here is an example in Scala: > [...] > def getString(s : String) : Option[String] = > { > if (s.reverse == s) Some(s.toLowerCase) > else None > } > [...] > val t = getString(s) > [...] > t match > { > case Some(r) => println("Success, return value is: " + r) > case None => println("Failure") > } Ah, thanks. Yep, I've seen this concept once when playing with OCaml (which mentions Haskell as one of its roots). Never got warm with it, though. In the end, it isn't all that more concise than C++/Java... It's a bit like C's unions with some byte ahead to tell which of the variants is the current one, and bunch of logical operations that is often trivially converted into a couple of (possibly nested) "if-else"s. I'm not saying it's bad, just it didn't impress me all that much, so far.