TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Zen and the art of statefulness

4 点作者 skilldrick超过 14 年前

1 comment

ohyes超过 14 年前
"The above code uses an IIFE (Immediately-invoked function expression) to produce a function with additional data"<p>I'm probably being a mindless pedant, but...<p>Having read the linked (Alman) article, I think this terminology is iffy at best. This is just a closure. You are using a second function to create a lexical scoping, but a closure without lexical scope is just an anonymous function. (Full name of a closure being a lexical closure).<p>If JavaScript had a 'let' construct to allow for lexical scoping without creating anonymous functions, this would be fairly easy to see.<p>But I think adding new terminology such as 'IFFE' obscures what a closure actually is.
评论 #2219322 未加载
评论 #2219276 未加载