Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
In c# those are called delegates and instances
You create a function prototype as a data type and instantiate it around another method with the same prototype or assign a lambda or anonymous function to it.
Why are they calling them closures?
Root8022246dClosures / IIFE’s (terrible name) also include some scope, whereas an instance does not. Well, it can via pointers, which is all JS is doing, but it feels like more while working with them. Also, classes in JS are very different beasts, so they probably use a different term to avoid dev confusion thanks to their stupid decisions surrounding classes. Just conjecture, though.
As for “memoization” not appearing in the dictionary… I have absolutely no idea. I believe “cruft” is present, despite also being a programming-only term. Seems odd that the former wouldn’t be.
lbfalvy1034445dLambda is a term older than computers, and closures were a property of lambdas for as long, though I'm not sure whether Church ever used this term. In many OO languages, lambdas and closures are actually imitated using classes and instances because the language already provides the necessary optimizations for these.
Though these terms overlap, their equivalence is dependent on the specifics of the abstraction. Depending on the language, there may be things that are definitely closures and not classes, and things that are definitely classes and not closures.
closure has some mathematical meaning that these anonymous scopes or functions provide so that is okay in my book.
"memoization" ticks me off, it's just a local cache FFS. There even exists a similar word for it: memorization.