[TUHS] v7 K&R C
Noel Chiappa
jnc at mercury.lcs.mit.edu
Sun Apr 26 04:03:57 AEST 2020
> From: Rob Pike
> To make chaining of calls simpler. Write
> f()->g()->h()->i()
> the other way
You mean:
(*f)((*g)((*h)((*i)())))
I dunno, it doesn't seem that much worse to me.
What I like about the explicit notation (i.e. (*f) ()) is that it forces the
programmer to recognize what's going on.
On the other hand, I guess, the whole concept of compiled languages is to get
the programmer's nose out of the low-level details, so they can focus on the
high level. So I guess one could see allowing f() in place of (*f)() as an
instance of that.
Then again, down that road you find a lot of modern code, where a programmer
writes something that is e.g. horribly inefficient and slow, precisely because
they are so divorced from the low-level of what the code they wrote turns into...
Still, I'd be a little worried about a program doing (*f)((*g)((*h)((*i)()))),
no matter what the notation was; it would be awfully hard to recognize what
all the possible call chains are. But then again I guess a lot of e.g. AI code
does things like that...
Noel
More information about the TUHS
mailing list