ROOT6, defining function in interpreter

I am in the process of upgrading my code for ROOT6, and was testing out the new interpreter

Why is it that I can define a lambda function or templated function in the interpreter, but I cannot define a regular function?

root [0] auto func_lambda = [](){std::cout << "lambda works" << std::endl; }
((lambda) &) @0x7fd736327028
root [1] func_lambda()
lambda works
root [2] template<typename T=void> void func_templated(){std::cout << "templated_function works" << std::endl;}
root [3] func_templated()
templated_function works
root [4] void func_regular(){std::cout << "regular function doesn't work" << std::endl;}
ROOT_prompt_4:1:20: error: function definition is not allowed here
void func_regular(){std::cout << "regular function doesn't work" << std::endl;}
root [5]


good observations.
It is at the moment not possible to directly define a function at the commandline interpreter.
There are several ways to achieve that though with very little effort, e.g.:

  1. Enable the raw input mode: just type .rawInput, your function and then .rawInput to re-enter normal edit mode
  2. Inject the code in the interpreter as a string with a gInterpreter->Declare(“here the function!”) call.