C and all the many languages that copied from it don't use any keywords to declare a function -- you just to <returned type> <function name>(<arguments)
. void
is just the way to say "no type at all", i.e. what we used to call a "subroutine" or "procedure" (a "function" that doesn't return any value).
function
, as used in Javascript, is clearly a sharp and immediately obvious keyword, equally usable for both named and nameless functions. IMHO, the best of the bunch.
I don't know what Guido was thinking when he chose def
for named functions and lambda
for unnamed ones (the Netherlands, where he was born and raised and where he was living at the time, has many wonderful beers, of course;-). Ruby just adopted def
from Python, maybe just because it's short (but it has no sensible meaning or interpretation...!).