Functions should default to returning void if the return type is omitted #737
Labels
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
Milestone
The fact that the function is not intended to return anything is immediately obvious to both the programmer and anybody reading the code. Omitting the return type is a nice shortcut that doesn't increase the complexity of the language and doesn't require huge changes to the compiler internals. It has the advantage of improving code readability by getting rid of things the developer needs to read that do not aid in understanding the semantic meaning of the code.
Example return-less (distinct from
noreturn
, of course) function definition:As an optional consideration, perhaps it may be possible to omit the call brackets for functions with no arguments too? I'm unsure whether this creates parser ambiguities, however. Example:
The text was updated successfully, but these errors were encountered: