Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #25545

Re: Java vs C++

Date 2011-02-09 01:07 +0800
From Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com>
Newsgroups comp.lang.java.programmer
Subject Re: Java vs C++
References (14 earlier) <iio27n$g2f$2@lust.ihug.co.nz> <4d507f8a$0$32793$c30e37c6@exi-reader.telstra.net> <iiqcjh$qt4$5@lust.ihug.co.nz> <slrnil26hf.nej.avl@gamma.logic.tuwien.ac.at> <iirebq$9k4$1@news.albasani.net>
Message-ID <W5ydndPs8Y3d5czQnZ2dnUVZ_rgAAAAA@posted.palinacquisition> (permalink)

Show all headers | View raw


On 2/8/11 8:53 PM, Lew wrote:
> The problem with reifiable types is that it's too easy to do a
> half-assed job of your type analysis, thus resulting in the runtime
> errors to which Andreas alludes. Besides, all you need to do to get
> runtime typing is to include a runtime type token as a final member of
> your class and Bob's your uncle. Like so much else in Java, that just
> means you have to *think* and act for yourself, and type a few extra
> lines of code. Don't sprain your finger with that extra typing, whiners!

I agree that type erasure is not a huge liability in Java.  As long as 
you always use the generic type as a generic rather than raw type, 
compile time checking will do the job.

However, type erasure does limit what you can do via reflection, which 
is something very important at times.  Another advantage of reified 
types is the ability to use generics efficiently with value types, 
rather than having to box them.

Of course, Java doesn't have user-defined value types, but it would be 
potentially useful even for the built-in ones.

As in all cases, it's not _universally_ useful.  But they are worth 
having reified types, IMHO.

Pete

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Java vs C++ Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-07 15:08 +1300
  Re: Java vs C++ Arne Vajhøj <arne@vajhoej.dk> - 2011-02-06 21:19 -0500
    Re: Java vs C++ Peter Duniho <NpOeStPeAdM@NnOwSlPiAnMk.com> - 2011-02-09 01:07 +0800
    Re: Java vs C++ Arne Vajhøj <arne@vajhoej.dk> - 2011-02-07 19:44 -0500
    Re: Java vs C++ Lawrence D'Oliveiro <ldo@geek-central.gen.new_zealand> - 2011-02-07 15:53 +1300
      Re: Java vs C++ Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-02-08 10:25 +0000
      Re: Java vs C++ Esmond Pitt <esmond.pitt@bigpond.com> - 2011-02-08 10:26 +1100
      Re: Java vs C++ Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-06 22:06 -0500
      Re: Java vs C++ "Mike Schilling" <mscottschilling@hotmail.com> - 2011-02-06 22:42 -0800
      Re: Java vs C++ Joshua Cranmer <Pidgeot18@verizon.invalid> - 2011-02-07 21:20 -0500

csiph-web