/Users/cbeust/fan/curry.fan(30,7): Invalid args |sys::Void|, not ()
-- Cedric
brianTue 24 Jun 2008
Like method signatures, you only use Void for return. Unlike methods, you can omit the Void return (it is optional):
|Void -> Void| fun // illegal just like Void m(Void) would be
|->Void| fun // ok
|,| fun // shortcut for above
|Int->Void| fun // ok
|Int| fun // shortcut for above
tompalmerTue 24 Jun 2008
Can I count these questions as evidence that it's confusing when methods put the return type on the left but function types and closures put the return type on the right?
cbeust Tue 24 Jun 2008
How come the following compiles fine:
but if I change the return type of the closure to Void, the compiler complains:
The error corresponds to the fun() invocation:
-- Cedric
brian Tue 24 Jun 2008
Like method signatures, you only use Void for return. Unlike methods, you can omit the Void return (it is optional):
tompalmer Tue 24 Jun 2008
Can I count these questions as evidence that it's confusing when methods put the return type on the left but function types and closures put the return type on the right?
helium Wed 25 Jun 2008
No