Formatting Functions
I’ve written and edited a little over two million words of computer-related material in the last 35 years.
For much of that time I wrote time()
to mean “the function whose name is time
”.
The empty parentheses aren’t part of the name:
they’re there to remind readers that this is a function.
I stopped doing this about ten years ago for three reasons:
-
Someone asked me, “Then shouldn’t I write
numbers[]
when it’s an array ornames{}
when it’s a dictionary? -
I discovered that some novice readers had trouble distinguishing between “the function called
time
” or “a call totime
with no arguments”, since I was writing both astime()
. -
I started writing more about functional programming, and even I found it confusing to figure out whether “pass
a()
tob()
” meant “pass the functiona
to the functionb
” or “pass the result of callinga
tob
” or “pass the result of callinga
to the result of callingb
” (all of which I wanted to do in the same section of one tutorial).
I realize that the f()
notation is deeply ingrained and unlikely to change,
but I wonder if anyone has ever studied whether it leads to any more confusion
than parenthesis-free notation.
It’s the kind of thing that educators refer to as
pedagogical content knowledge,
and I wish we had more of it.