Path: csiph.com!eeepc.pasdenom.info!news.pasdenom.info!news.dougwise.org!gegeweb.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Joshua Cranmer Newsgroups: comp.lang.java.programmer Subject: Re: Java vs C++ Date: Sun, 06 Feb 2011 22:06:05 -0500 Organization: A noiseless patient Spider Lines: 20 Message-ID: References: <4d4d585c$0$81476$e4fe514c@news.xs4all.nl> <4d4d60dc$0$23763$14726298@news.sunsite.dk> <4d4d8322$0$41117$e4fe514c@news.xs4all.nl> <4d4f43d9$0$23755$14726298@news.sunsite.dk> <4d4f56ac$0$23758$14726298@news.sunsite.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 7 Feb 2011 03:06:05 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="LtjcJP1H6uHOtkcPMh0bUA"; logging-data="8188"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CXZ1MtjulDoaxzmiNqP9jlD7aL3hmAq4=" User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12pre) Gecko/20101019 Lightning/1.0b3pre Thunderbird/3.1.6pre In-Reply-To: Cancel-Lock: sha1:iAh2AeVd0nZG1FUrz9fhAYHxQ6c= Xref: csiph.com comp.lang.java.programmer:25972 On 02/06/2011 09:53 PM, Lawrence D'Oliveiro wrote: > In message<4d4f56ac$0$23758$14726298@news.sunsite.dk>, Arne Vajhøj wrote: > >> As explained numerous times then Java generics and C++ templates >> are somewhat different. > > The only differences arise from limitations of Java, nothing more. That is not an assertion you can make. Java generics and C++ templates are different because their designers wanted them to be different. It would totally have been possible to implement C++ templates in Java--but the designers decided that was not what they wanted to do. I don't know what they would have done if they had added generics from the start, but given all of the issues seen with templates, I am willing to guess that it would still act nothing like templates do (i.e., as Java generics do know, just with fully reified types). -- Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth