Yes, I actually warn about this in the manual (
https://github.com/atsepkov/RapydScript#leveraging-other-apis). Being indentation-based like Python, RapydScript has no way to know that the block has ended by seeing the second parenthesis. So while your syntax appears correct to a human, from compiler perspective it's a syntax error because it's still parsing the inner function when it encounters a redundant parenthesis. The correct format for this is either:
func(def(x):
alert(x)
)
Or:
func(def(x):
alert(x);)
Note the semi-colon, this also works, btw:
func(def(x): alert(x);)
You can even put more args or other functions after the semi-colon if you want:
func(def(x): alert(x);, 'foo', 'bar', 'baz', def(x): return 'qux';, 'quux')