function types with void return type

# Hallvord R. M. Steen (18 years ago)

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?

# Lars T Hansen (18 years ago)

A bug, no doubt. I'll file it (bugs.ecmascript.org -- 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.)