Hi,
I want to define a function that returns a value but does so in a compound statement.
the result should be something like this:
def foo(prm1 : Int) = {
...
...
x+y
}
notice that this is basically a valid Scala function definition, scala does not require a return type and allows one to 'assign' a body to a function.
I've tried to generate something like this with TreeHugger_2.10 v0.3.0 by doing this:
DEF("toBean") := BLOCK(stmts)
where stmts is a list of trees, this generates a procedure:
as you can see, no assignment is generated :-(, this actually behaves like the docs says it should, but it doesn't make to much sense as replacing the block with LIT(0) will generate a function instead of a procedure.
according to the docs, I can workaround this issue by supplying a return type to DEF, which may be reasonable in this case, but I'd like to know:
sf there's a way to omit the return type, supply a block and still get a function definition instead of a procedure?
thanks,
Eyal.