Feedback for the command syntax and the behavior of the temporary variable

Paul Sandoz paul.sandoz at oracle.com
Mon Jun 29 07:49:10 UTC 2015


On Jun 28, 2015, at 7:11 AM, ShinyaYoshida <bitterfoxc at gmail.com> wrote:
> 2. Opinion for the behavior of the temporary variable.
> His opinion is "Currently the temporary variable can be re-assigned, but it
> doesn't make sense. It should be final.":
> 
> -> 0
> |  Expression value is: 0
> |    assigned to temporary variable $1 of type int
> 
> -> $1 = 10
> |  Variable $1 has been assigned the value 10
> 

I was wondering about that too. So far i have persuaded myself this behaviour is ok since it is not possible to have explicit `final` variables:

  -> final int i = 0
  |  Warning:
  |  Modifier 'final' not permitted in top-level declarations, ignored
  |  final int i = 0;
  |  ^---^
  |  Added variable i of type int with initial value 0


I noticed another potential inconsistency:

  -> "foo"
  |  Expression value is: "foo"
  |    assigned to temporary variable $1 of type String

  -> int x = 1
  |  Added variable x of type int with initial value 1

  -> x
  |  Variable x of type int has value 1

I was expecting x to be assigned to a temporary variable.

Separately, it may not be that hard to support the following gIven the support for assigning the value of an expression to a temporary variable:

  > x = 1
  |  Added variable x of type int with initial value 1

Paul.


More information about the kulla-dev mailing list