HaxeManual icon indicating copy to clipboard operation
HaxeManual copied to clipboard

Changed description of function

Open CoruNethron opened this issue 6 years ago • 3 comments

"a compound type of several arguments and one return" may be misunderstood as "one return statement", but in fact it means "one return value". Also, there might be no return value, i.e. [Any]->Void

CoruNethron avatar Dec 02 '18 03:12 CoruNethron

This leads to the old "is Void a type" discussion. I agree the original isn't 100% accurate, but IMO your change isn't any better (and has weird grammar). I'll leave this open as a reminder but will push a different fix.

Simn avatar Dec 02 '18 08:12 Simn

@simn Any thoughts on this? What about:

a function which expects zero or more arguments of specific types that will return a value when called

I think it's fine to consider Void a value here so we don't complicate the short description.

Aurel300 avatar May 24 '19 19:05 Aurel300

This leads to the old "is Void a type" discussion.

Whether or not it's a type, I think we can all agree it's a return type. Which suggests a simple change:

  • Function: a compound type of several arguments and one return type

Or for consistency:

  • Function: a compound type of several argument types and one return type

Or if you're fine leaving out the reference to "compound type":

  • Function: a collection of argument types plus one return type

Or to make it clearer that we're talking about the function type and not a function definition:

  • Function: a function signature, consisting of a number of argument types plus a return type

...but that doesn't quite fit the rest of the page. The rest of the page draws less distinction between the type and the value stored in a variable of that type. Perhaps this would fit better:

  • Function: a Haxe function, with known argument types and return type

player-03 avatar Sep 30 '22 00:09 player-03