Hacker News new | past | comments | ask | show | jobs | submit | _Daniel_'s comments login

The author makes some fair points. Java generics are a bit clunky. C#'s more liberal application of autoboxing can be nice. Some other options for string literals would be helpful, especially for writing regular expressoins without a ton of backslashes.

Checked exceptions are not something that I'd happily give up. We do have unchecked exceptions (RuntimeException), and the JRE generally uses them where appropriate. But what about methods like Inflater.inflate, ImageIO.read, or Class.getMethod? If these didn't throw checked exceptions, we would sometimes forget to catch exceptions which should almost always should be caught. It would be a step in the direction of a weaker type system, unhelpful errors, and less graceful recovery.

Regarding initializers, we can do the same thing in Java by giving an initializer block to an anonymous class:

    List<Integer> L = new ArrayList<Integer>() {{
        for (int i = 0; i < 10; ++i)
            add(i);
    }};


Equivalent code in c#:

     var l = new List<int>(Enumerable.Range(0, 10));


Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: