scala - Do I need a trailing semicolon to disambiguate this code? -
if omit semicolon, code doesn't compile.
def checkradiobutton(xml: dslbuilder): string => xmltree = { val inputs = top(xml).\\*(haslocalnamex("input")); { (buttonvalue: string) => // code omitted } }
my guess that, without semicolon, scalac thinks partial function argument \\*
method, instead of return value. (it isn't partial function, way, it's total function.)
can without semicolon here? i've never had use semicolon @ end of line before in scala.
i’d write instead:
def checkradiobutton(xml: dslbuilder): string => xmltree = { val inputs = top(xml).\\*(haslocalnamex("input")); (buttonvalue: string) => { // <-- changed position of { // code omitted } }
Comments
Post a Comment