Forum Stats

  • 3,853,788 Users
  • 2,264,269 Discussions
  • 7,905,444 Comments

Discussions

Generics and Java - The story behind the controversy

843793
843793 Member Posts: 41,732 Green Ribbon
edited Jul 6, 2002 4:28PM in Generics
Generics and Java
The story behind the controversy

http://www.javaworld.com/javaone01/j1-01-sintes3_p.html

I've only skimmed the article so far, but these two comments leap out.

Bracha pointed out that one problem with C++ templates is code bloat. For every List<T> of type T , C++ generates a separate class. Generics as implemented by JSR-014 will not cause similar bloat: the same class and associated bytecode will work for all Lists of T.

Bracha stressed the generics specification's conservative nature and its avoidance of major VM specification changes. As such, VM vendors won't be forced to make major changes to every J2SE and J2ME VM in existence. ... The specification also ensures backward compatibility so that old code can run unmodified on a VM that supports generics. This is critical, since the collection classes and thread classes will be rewritten to support generics.

Comments

  • 843793
    843793 Member Posts: 41,732 Green Ribbon
    I don't understand what you save except for some typing. Could someone explain that bit to me? Im sure this has been argued just by the fact that this forum is here, but I am behind the times appearantly.

    If they add these 'templates' they might as well add a complete pre-processor. Their was really nothing more about c++ that I hated than having such a hard time understanding what the code did.

    How will stepping through the debugger be handled? The source won't match the bytecodes.

    I really wish this would not be added. For me I can just ignore it, but for Java its a surrendering to old forces and it really takes away from the Java philosophy and sugar coates it with some .NETish mess. IMHO
  • 843793
    843793 Member Posts: 41,732 Green Ribbon
    I don't understand what you save except for some
    typing. Could someone explain that bit to me? Im
    sure this has been argued just by the fact that this
    forum is here, but I am behind the times appearantly.
    Errors are found at compile time rather than at run time. If you don't understand how this is helpful, imagine that javac reported no errors of any kind, even the worst syntax error. The only time you'd be notified of an error is if the line of the code that contained the error was executed. What would happen to your productivity?

    If you still don't get it, read Writing Solid Code.

    If they add these 'templates' they might as well add a
    complete pre-processor. Their was really nothing more
    about c++ that I hated than having such a hard time
    understanding what the code did.
    Java generics aren't C++ templates.

    How will stepping through the debugger be handled?
    The source won't match the bytecodes.
    Why wouldn't it?

    I really wish this would not be added. For me I can
    just ignore it, but for Java its a surrendering to old
    forces and it really takes away from the Java
    philosophy and sugar coates it with some .NETish mess.
    IMHO
    Strange, Bill Joy and James Gosling don't agree with you! ;-)
  • 843793
    843793 Member Posts: 41,732 Green Ribbon
    You really didn't provide any additional information. Though from other sources I think I understand it now.
This discussion has been closed.