Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: ensuring unreachability Date: Wed, 18 Feb 2015 08:49:00 -0500 Organization: A noiseless patient Spider Lines: 30 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 18 Feb 2015 13:48:23 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="858a9d65d95f4ea4d355bd116aa2cdbf"; logging-data="5107"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EMktXLpo2MgTqLxNnYRxg" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 In-Reply-To: Cancel-Lock: sha1:t6XgcdLz1Ps9fEarsY3WqNovFKo= Xref: csiph.com comp.lang.java.programmer:31144 On 2/17/2015 7:40 PM, Andreas Leitgeb wrote: > Eric Sosman wrote: >> [...] >> IMHO, this particular cure is a lot worse than the disease. > > Despite your own judgement of it, this is awesome! Now, I wish I hadn't posted it. It's vile, merely a curiosity and not a practical solution. I sincerely hope you will not use it. Remember, the underlying purpose is to guard against a maintainer who might inadvertently introduce a fall-through. A maintainer is equally likely to notice that the `once' variable serves no purpose (many IDE's will tell him so), and will improve the code by eliminating the useless variable. Where then will your guard go? I believe my other suggestion -- eliminating the last `else' -- is a far better solution: More direct, more readable, and more robust. > Thanks! Be sure to thank me again after my ill-conceived gimmick breaks ... -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM