getify / You-Dont-Know-JS

A book series on JavaScript. @YDKJS on twitter.
Other
178.28k stars 33.42k forks source link

inter-invoked functions acronym (IIF) is used before it is defined #1667

Closed maxgabut closed 4 years ago

maxgabut commented 4 years ago

In Appendix A of the second edition of "Scope & Closures", IIF is used to refer to inter-invoked functions.

Unless I missed something, it is first used before it is defined. It might make sense to define it earlier.

The first use is in Are shynchonous callbacks stille closures:

  • IIF functions don't move around, why would they need closure?

Definition is in Synchronous callback:

Let's refer to (the functions formerly known as) synchronous callbacks, as inter-invoked functions (IIFs).

getify commented 4 years ago

You're technically correct, but that bullet point is "hoisted" to the top of that section as sort of preview/table-of-contents... it's not content itself. It's saying, "hey, look out for the following topics to be covered over the next few sections". IOW, it's good that you ask "what is an IIF?" when reading that, because that's the point of the table of contents.

I had contemplated expanding that acronym there, but it seems unnecessary since I haven't explained what "inter-invoked function" means yet at that point either, so it's just extra noise.

getify commented 4 years ago

Oh... also... there's a very subtle pun intended there, which is signaled by the italics. The sentence is saying "if functions are..." as in a postulated conditional. The pun is that "IIF" is pronounced the same as "if".

maxgabut commented 4 years ago

Well yes, expanding the acronym would not help much without a longer explanation (that comes later).

I was a bit confused by it because I confused it with an IIFE (I thought : what's that "IIF" already ? Oh right, the Immediately Invoked Function thingy). But, I guess that's on me :sweat_smile: