News for hackers. Stuff that matters.
Re:John Carmack on Inlined Code by salmonellaeater on Friday September 26, 2014 @09:43PM (#8375761)
> Unfortunately, this conflicts with the (common, good) advice to make as many variables final / const as possible, since it separates the declaration of a variable and its assignment.

In Java you can separate the declaration and assignment of a final variable as long as every branch provably assigns to the variable. For example:

  final int x;
  if(someCondition) {
      final int a = 1;
      final int b = 2;
      x = a + b;
  } else {
      x = 0;
  }
Re:John Carmack on Inlined Code by bkirwi on Friday September 26, 2014 @10:09PM (#8375813)
I did not know this; thanks! I think I still prefer Scala's structural style, but I'll definitely have good use for this when I wander back into the Java universe.