From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ad988eb0a9545c86 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-04-17 12:36:44 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!128.230.129.106!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!news.mindspring.net!not-for-mail From: Larry Hazel Newsgroups: comp.lang.ada Subject: Re: Problem trying to implement generics. Date: Tue, 17 Apr 2001 14:32:08 -0500 Organization: MindSpring Enterprises Message-ID: <3ADC9A38.BE9BD8F6@mindspring.com> References: <9b46dr$cd8$1@taliesin.netcom.net.uk> <9b6jtu$4is$2@taliesin.netcom.net.uk> <9b6m27$68e$1@taliesin.netcom.net.uk> <0JBB6.10484$FD1.1197250@news6-win.server.ntlworld.com> <9b7tce$laf$2@taliesin.netcom.net.uk> <3ADC4320.7ACA3DEC@averstar.com> <9bhoup$h9k$1@taliesin.netcom.net.uk> <3ADC7A79.8E853905@mindspring.com> NNTP-Posting-Host: c7.ae.9c.17 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Server-Date: 17 Apr 2001 19:32:05 GMT X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en,x-ns11F8K63r3NhQ,x-ns2r2e09OnmPe2 Xref: supernews.google.com comp.lang.ada:6953 Date: 2001-04-17T19:32:05+00:00 List-Id: Brian Rogoff wrote: > > On Tue, 17 Apr 2001, Larry Hazel wrote: > > Ayende Rahien wrote: > > > > > > "Tucker Taft" wrote in message > > > news:3ADC4320.7ACA3DEC@averstar.com... > > > > > > > Interestingly enough, the standard Iterator in Java > > > > uses: > > > > while (Iter.hasNext()) { > > > > X = Iter.next(); > > > > ... > > > > } > > > > > > > > even though Java has functions with side effects (although > > > > in fact, only with side-effects on by-reference operands, > > > > since it has no parameter modes at all!). > > > > > > Why use it like this? > > > for (;Iter.hasNext(); X = Iter.next() ){ > > > //do stuff > > > } > > > > > > Is much more readable, IMO. > > > > I disagree. The C style for loop is totally unreadable garbage IMO. > > Well, to a C programmer the for loop is perfectly readable. As someone > familiar with C, Java, Ada, and a few other languages, I have to say that > I found Tucker's original expression far preferable to Ayende's, > though I'd prefer "hasMore" to "hasNext" :-). Ayende, why do you find the > for loop preferable in this case? > > As long as we're considering iterators, it should be mentioned that > iterators are one of the great examples for adding downward funargs into > the language. > > > In what little C programming I have done, I refused to use for loops. > > Did you use macros to set { and } to BEGIN and END too? > I thought about it, but just commented the } instead. Larry