28 December 2008

Null handling: Small language changes on JDK 7

The idea is about allowing people to handle null object situation as easy as possible (here by new operator). And I agree with that since even before.

Discussion can be seen on:

Current (sample) implementation use '?.' as operator, but in my opinion '.?.' would be more appropriate, because '?' following directly by some name can be hardly noticed when we only inspect code. Example:

This attribute can be important for people who did not used to this operator.

Autoboxing issues

Most disputation about this operator connects with autoboxing issue where options are:

  • Forbid autoboxing that is simple and should not bring any problems, as we still have if and (?:).
  • Turn on autoboxing that can kill program efficiency and through exception.
  • Turn on autoboxing only if object is a target.
  • Add other operator to this one.
Notice that forbidding autoboxing is a good solution because does not cause unnecessary syntax complication. Autoboxing (if object is a target) responses to operator logic and what's important, it should not cause any additional bad impacts on program logic. What more adding another operator may drastically increase code complication.

0 comments / komentarz(y):

Post a Comment