Oxygene: var block before begin in anonymous methods

I’m not sure if this is a bug report or a feature request, but it would be nice to be able to declare variables in a var block before begin in anonymous methods.

button.setOnTouchListener(
  new class View.OnTouchListener (
	onTouch := method (v: View; theEvent: MotionEvent): Boolean;
	  var
		id: Integer;
		name: String;
	begin
	  { do something }
	  exit true;
	end
  )
);

I get a build error "begin" expected, got "var" when I do this.

I’m afraid that for ambiguity reasons, closures can only use inline variable declarations (which are recommended, anyways).

Why is the block declaration any more ambiguous? In either case, the variables are scoped to the method, right?

remember that this shows construct lives within a statement, so clear scooping is needed for the cops;iler to determine what stars and ends where. with var declarations outside of the method body, things could become ambiguous depending on the complexity. for example, imagine the var block defined a var pre-initialized to yet an other closure, and that closure then has a var block of its own? I’ll become impossible to tell which things fit together where.

Marc,
I also prefer to use inline variables, but the compiler can do as if the variables are declared inline at the beginning of the method, no?

Yes, that part is not the problem, but:

button.setOnTouchListener(
  new class View.OnTouchListener (
	onTouch := method (v: View; theEvent: MotionEvent): Boolean;
	  var
		id: Integer;
		name: String;
                nasty := method();
                   var 
                        x: string;
                        y: int;
                        supernasty := method();
                        begin
                        end;
                       z: boolean;
                  begin
                  end;
               name2: string;
	begin
	  { do something }
	  exit true;
	end
  )
);

things get pretty out of hand here quickly.