Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!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: "null", polymorphism and TCO Date: Sun, 08 Feb 2015 15:03:56 -0500 Organization: A noiseless patient Spider Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 8 Feb 2015 20:03:20 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="bd4e1cba8d8592bec5d5ed9e4537fbfd"; logging-data="10504"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5+2YMZKA8yENDvBv+cBLF" 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:5cHOR6wLfTgppbj7yPmtr7FkxAM= Xref: csiph.com comp.lang.java.programmer:31088 On 2/8/2015 1:16 PM, Stefan Ram wrote: > A book said that one needed null to mark the end of a linked > list: > [...] > Neither null nor java.util.Optional is needed when one > is using polymorphism, i.e., real OOP. We just need to say > that an entry with a next entry is a different type than > an entry without a next entry. No »null«, no »Optional«, > just polymorphism! > [...] When I was a young lad and learning my first programming language (FORTRAN II; "young" was long ago for me), I figured out how to write a counted loop using a "computed GOTO" instead of a "DO". Thus I proved my own great cleverness. ISTM your idea is similarly clever -- and similarly useless. -- esosman@comcast-dot-net.invalid "Don't be afraid of work. Make work afraid of you." -- TLM