function types with void return type

Lars T Hansen lth at
Wed Nov 7 05:13:58 PST 2007

A bug, no doubt.  I'll file it ( -- open to
all comers).

My expectation would be a compile-time error if a void function tries
to return a value since it's syntactically detectable, but I don't
remember it being discussed in the group.  (Obtaining the return value
from a void function would be compile-time or run-time, depending on
what the compiler knows.)


On 11/7/07, Hallvord R. M. Steen <hallvord at> wrote:
> Language overview states: "The return type of a function can be written
> void, which means that no return value is allowed.".
> But the reference implementation doesn't complain about this:
> >> type F = function(int,int):void;
> >> var f:F=function(a,b){return a+b;};
> >> f(2,2);
> 4
> Is the constraint described in the overview prose meant to be applied
> here? If so, when?
> --
> Hallvord R. M. Steen
> Core QA JavaScript tester, Opera Software
> Opera - simply the best Internet experience
> _______________________________________________
> Es4-discuss mailing list
> Es4-discuss at

More information about the Es4-discuss mailing list