[Types-sig] type declaration syntax

Greg Stein gstein@lyra.org
Fri, 17 Dec 1999 20:27:58 -0800 (PST)


On Sat, 18 Dec 1999, skaller wrote:
>...
> But the _return_ type doesn't need to be annotated as much.
> Why? Because the inferencer can usually deduce it:
> it's an output, the argument types are inputs.

Users of the function need the return type. The inferencer won't be
global -- it isn't going to look at the function to determine the return
type. In order to skip that requirement, we annotate the return type. The
caller then simply assumes the return type is correct.

When compiling the function in question, the compiler can verify that the
declared return type is truly what the function will return.

>...
> One problem with :, that is probably a killer: it cannot
> work with lambdas:
> 
> 	lambda x:Int, y: woops

Good point. I'll need to update my page with this issue.

> [I'm not saying if this will kill ":" or lambda though  :-]

Heh. I would simply state that lambda cannot be annotated. If people want
the annotation, then they should use "real" functions. I know that would
please Guido's desire to deprecate lambda :-)

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/