For some time I’ve noticed that people are using the word “closure” for things that — at least from my perspective and programming background — aren’t closures. They keep using the word, when that’s not what it means. This has been going on for about a decade and a half and I’ve just bit my tongue, but it’s getting ridiculous at this point, and this abuse/misuse comes with a hefty penalty.

一段时间以来,我注意到人们在至少从我的角度和编程背景来看,不是封闭的东西使用“封闭”一词。 当这不是这个词的意思时,他们会继续使用该词。 这种情况已经持续了大约十年半的时间,我只是有点口舌,但是在这一点上,它变得荒谬了,这种滥用/滥用会带来高额的罚款。

Right now, the popular flavor is to use the term to refer to any block of code that’s self contained or has a scope isolating behavior; like a function. That’s NOT a closure.

目前,流行的用法是使用该术语来指代任何自包含的或具有范围隔离行为的代码块。 就像一个功能。 那不是关闭。

Maybe it’s my having learned “real’ programming in assembler long before TBL even created HTML. Maybe it’s my having spent a decade writing code in Ada… Maybe it’s because I’m old enough to have least been taught about PAL despite not having ever actually programmed for it…

也许是在TBL甚至还没有创建HTML之前,我就已经在汇编程序中学习了“真正的”编程。 也许是因为我花了十年的时间在Ada中编写代码……也许是因为我年纪大了,尽管没有真正为PAL编程,但对PAL的了解却最少。

But from everything I ever learned, that’s not a closure.

但是从我所学到的一切来看,这并不是闭包。

那么,如果不是的话,什么是封闭呢? (So What Is a Closure If Not That?)

What I was taught in decades past, is that a closure is something that ENDS a block of code or execution. It’s part of the word, closure. From the root “Close”. Like a door. Lands sake people get a dictionary:

在过去的几十年中,我所学到的是,闭包可以结束一段代码或执行代码 。 这是关闭这个词的一部分。 从根目录“ Close”开始。 像一扇门。 土地使人们得到一本字典:

关闭 (clo·sure)

/ˈklōZHər/

/ ˈklōZHər /

  1. An act or process of closing something, especially an institution, thoroughfare, or frontier, or of being closed.封闭某事物或事物的关闭的行为或过程,尤指机构,通途或边界
  2. (in a legislative assembly) a procedure for ending a debate and taking a vote.(在立法议会中)结束辩论并进行表决的程序。
  3. A sense of resolution or conclusion at the end of an artistic work.艺术作品结束时的决心或结论感。

Thus the keyword “end” in Wirth family languages — Pascal, Modula, Ada — and the closing curly bracket “}” in C syntax languages — C, C++, JavaScript, Java, PHP — are closures. “RETURN” is a closure. “BREAK” and “CONTINUE” by handing control out of the block to the logic structure is a closure. In assembly “RET” and “JMP” are closures. Because they close or end that block of execution and/or scope!

因此,Wirth族语言(Pascal,Modula,Ada)中的关键字“ end”和C语法语言(C,C ++,JavaScript,Java,PHP)中的右花括号“}”是闭包。 “返回”是一个结束符。 通过将控制权移交给该逻辑结构,“ BREAK”和“ CONTINUE”是一个闭包。 在装配中,“ RET”和“ JMP”是闭合件。 因为它们关闭或结束了执行和/或作用域!

At least, that’s what it meant when the term was coined for programming back in the 60’s and continued to mean until about a decade or two ago. That’s how I learned it in the ‘80’s.

至少,这就是当这个术语在60年代首次被提出来进行编程时所​​用的含义,并且一直持续到大约一两年前。 这就是我在80年代学到的方法。

It seems that JavaScript in particular seems to have this addle-minded obsession with the concept of scope blocks being a “closure”, with such trash as LET/CONST being proof enough of that. Because apparently, JavaScript fanboys are too feeble minded — or just plain lazy in naming conventions — for function level scoping to be sufficient. Talk about solutions in search of a problem! And remember, that’s coming from someone well versed in Ada.

似乎JavaScript似乎特别痴迷于范围块的概念是“封闭”,而LET / CONST这样的垃圾就足以证明这一点。 因为显然,JavaScript狂热者头脑太虚弱(或者在命名约定中只是懒惰),对于功能级别的作用域而言就足够了。 讨论寻找问题的解决方案! 记住,那是来自精通Ada的人。

为什么“使用错误的单词”不好? 您提到了“重罚” (Why Is “Using the Wrong Word” Bad? You Mentioned a “Hefty Penalty”)

It’s confusing beginners and old-timers alike!

这使初学者和老朋友都感到困惑!

Much like the W3C’s halfwitted derpy use of “empty” where <div></div> is not what they mean by an “empty tag”. Or “deprecated’ where they make it sound like we’re talking down to them like a petulant five year-old instead of being reduced in value (depreciated). It leads to confusion, misunderstandings, and just plain verbal gymnastics to explain a very VERY simple concepts.

就像W3C对“空”的傻瓜式欺骗使用一样,其中<div></div>不是“空标签”的含义。 或“贬值”,使他们听起来像是我们像一个五岁的小家伙,正在跟他们说话,而不是贬值(贬值)。 这会导致混乱,误解,甚至只是普通的口头体操来解释一个非常简单的概念。

Hence why we have know-nothing XML fanboys who STILL don’t understand why <DIV /> is invalid HTML or even XHTML regardless of which spec you’re using!

因此,为什么我们不了解XML的狂热者仍然不理解为什么<DIV />是无效HTML甚至XHTML,无论您使用的是哪种规范!

I often feel like certain groups in society — and this extends beyond programming — go out of their way to use obtuse, esoteric, and often incorrect language for the sole purpose of maintaining their L33T status. See legal lingo where a lawyer or judge will ask “can you make arrears” — a word nobody outside a courtroom uses in normal speech — rather than saying “can you pay the money owed?” It’s a way to confuse or mislead normal people with a less established vocabulary. I even had a lawyer explain legalese to me in those terms at one point.

我经常感到社会中的某些群体-不仅限于编程-出于保持L33T身份的唯一目的而竭尽全力地使用钝度,深奥的和通常不正确的语言。 请参阅法律用语,其中律师或法官会问“您能欠款吗?”(法庭外没有人在正常演讲中使用这个词),而不是说“您能偿还欠款吗?” 这是一种以不太成熟的词汇来混淆或误导普通人的方法。 我什至让一位律师用这些术语向我解释了法律术语。

In the case of programming this seems doubly true as it often seems the simplest of things — HTML and CSS for example — are poorly explained, poorly laid out, horrifically poorly documented, and rely on market-speak double-talk to try and make things look harder. Often this is done simply to make using these languages look more difficult than they are so someone can peddle their snake oil “framework”… where for all intents and purposes I keep expecting certain dev “experts” to start talking about how proactive their paradigms are.

在编程的情况下,这似乎是双重事实,因为通常似乎最简单的事情(例如,HTML和CSS)没有得到充分的解释,布置得不好,文件记录得令人毛骨悚然,并且依赖于以市场为基础的双向对话来尝试和制造事物。看起来更难。 通常,这样做只是为了使使用这些语言看起来比实际困难,以便有人可以兜售他们的“蛇油”“框架”……出于各种意图和目的,我一直期望某些开发“专家”开始谈论其范式的前摄性。

演示地址

There’s a reason when people start talking about software “ecosystems” I assume they’re playing bullshit bingo. After 40+ years writing software, a lot of these sick buzzwords are a good indication of when it’s time to cut your losses and run.

人们开始谈论软件“生态系统”是有原因的,我认为他们在玩 废话宾果游戏 经过40多年的软件编写,许多这些令人生厌的流行语很好地表明了何时该是时候减少损失并开始运营。

When you use a word for something it doesn’t even mean, OF COURSE BEGINNERS ARE GOING TO GET CONFUSED! You can see it on development forums, comments here on medium, and even in many articles on the topic people having issues understanding what’s being called “closures” and a good chunk of that simply boils down to effete know-nothings parroting THE WRONG HUFFING WORD!!!

当您将单词用于某物甚至不意味着什么时,当然,课程入门者会感到困惑! 您可以在开发论坛上看到它,也可以在媒体上找到评论,甚至在许多关于该主题的文章中,人们都有一些问题,他们理解所谓的“闭包”,而其中的很大一部分简直就是毫无用处的东西 ,这简直就是糊涂!!!

那么什么是正确的词? (So What Is The Right Word?)

外壳! (ENCLOSURE!)

Because it wraps around it. Like a fence or other barrier.

因为它环绕它。 像栅栏或其他障碍。

封闭 (en·clo·sure)

/inˈklōZHər,enˈklōZHər/

/ inˈklōZHər,enˈklōZHər /

  1. An area that is surrounded by a barrier.被障碍物包围的区域。
  2. The state of being enclosed, especially in a religious community.被封闭的状态,尤指在宗教团体中
  3. A document or object placed in an envelope together with a letter.放在信封中的文件或物体以及一封信。

Seriously people, get a copy of Oxford’s!

认真的人,得到牛津的副本!

I’m willing to bet there would be a lot less confusion or issues explaining the structure of functions or scope blocks if instead of mislabeling it a “closure” you called it an enclosure.

我愿意打赌,如果不是在错误地将其称为“闭包”(您将其称为en闭包)的情况下,解释功能或作用域块的结构的混乱或问题会少很多。

Just like as George Carlin joked, if they still called it “Shell Shock” I bet some of those Vietnam vets would have gotten the help they needed.

就像乔治·卡林(George Carlin)开玩笑一样,如果他们仍然称其为“ Shell Shock”,我敢打赌,其中一些越南兽医会得到他们所需的帮助。

Clean, simple, direct, honest language. Nope, can’t have that in the programming world, how else can we stay head and shoulders above the “mere mortals”.

干净,简单,直接,诚实的语言。 不,在编程世界中不能没有,我们还能如何在“凡人”上保持领先地位。

结论 (Conclusion)

I’m not sure why the past 15–20 years the term has become twisted into meaning something it’s not supposed to, but you’re just making it harder for the normies to make sense of things.

我不确定为什么在过去的15至20年中,该术语会变成不应该的意思,但是您只是在使规范难以理解。

Ray, you’re scaring the straights.

雷,你在吓直线。

翻译自: https://medium.com/the-innovation/closure-you-keep-on-using-that-word-348039c2fa22


http://www.taodudu.cc/news/show-4548026.html

相关文章:

  • 为什么没有参数的函数(与实际函数定义相比)会编译?
  • Urlencode编码对HTTP的URL地址的作用的探究(20210519更新,最终结论得出,XSS相关)
  • 论文阅读-2022.1.7-Don’t be Contradicted with Anything CI-ToD: Towards Benchmarking Consistency for Task
  • JavaScript 指南 - 使用对象
  • python编程新手常犯的错误_Python程序员常犯的10个错误
  • java避免空指针异常_第1部分:在现代Java应用程序中避免空指针异常
  • matlab电流可逆斩波电路,电流可逆斩波电路.PPT
  • 100%都会感染,第一波症状最重,后面会轻。家里一定要备这些东西!
  • dac0832三角波c语言程序,单片机控制DAC0832输出正弦波三角波汇编程序
  • 第五次实验:简单的使用示波器
  • 审计学习-审计概述02(政府审计和注册会计师审计+职业责任和期望差距+审计报告和信息差距+审计五要素+三方关系人+责任方责任+审计报告预期使用者+鉴证对象+披露+财报编制基础)
  • 「儒系」产品经理:管理预期,做好增长的3个核心要素
  • 浅谈ERP系统实施后如何完善企业内部控制制度建设
  • 迫在眉睫的企业内控与跃跃欲试的IT
  • 创新服务的七要素
  • 全新IT资源内控安全解决方案
  • 导入技能要素三大类_财务管理类专业(技能)课程体系
  • 企业在线ERP系统与内控控制因素管理
  • Revit API:Element 继承体系
  • Revit二次开发之职业精神篇
  • Revit API 开发 (10): ExtensibleStorage 外部存储
  • Revit二次开发手记【1】
  • Revit二次开发之技能篇(五)———模型轻量化.RVT到JSON实现的测试
  • 感谢帮我的人们(Revit二次开发)
  • Revit二次开发——元素信息绑定的两种方法
  • Revit API 开发周边:对 Element 进行 Reflection
  • 如何编程访问(读,写)Revit项目信息
  • Revit API 开发(12): Revit 文件存储结构
  • 给Revit中的Button添加动画和图片
  • Revit API 进阶之隐藏dll讲解.

关闭-您继续使用该词相关推荐

  1. 返回、取消与关闭的使用逻辑

    www.pmcaff.com 本文为作者 呆呆丶 于社区发布 在页面导航栏中,常会见到返回.取消与关闭三者按钮.许多同学会弄混它们的使用逻辑,所以写一篇小文帮助各位梳理下. 一.返回和关闭 先抛开图标 ...

  2. python生成词云_今天玩点啥:使用python生成微信好友地域分析、微信昵称、个性签名词云...

    # -*- coding: UTF-8 -*- from wxpy import *from wxpy import * from os import path import re, jieba im ...

  3. Python生成中文词云图(二):不可指定词云特定的形状和颜色。

    Python生成中文词云图(二):不可指定词云特定的形状和颜色. 什么是词云? 首先,什么是词云呢?词云又叫文字云,是对文本数据中出现频率较高的"关键词"在视觉上的突出呈现,形成关 ...

  4. 用Python爬取B站弹幕并做成词云

    用Python爬取B站弹幕并做成词云 一.获取视频的cid号 1.进入想爬的视频,打开浏览器设置里的"开发者工具": 进入NetWork后等待requests刷出,数据够了后可随意 ...

  5. 游戏敏感词屏蔽词过滤

    游戏和网站,都需要敏感词(屏蔽词)过滤,你懂的.而且敏感词库不断的增长,从十几年前的3000多词,已经增长到14000以上(各渠道获取的词库略有不同). 这1万多词的扫描处理,开销的性能就有点客观了. ...

  6. 【Python实战】--词云制作

    系列文章目录 文章目录 系列文章目录 前言 一.准备工作 1.模块 2.字体 3. 背景图(词云形状) 4. 文本 二.制作词云 1.最简单的词云(中文) 2.最简单的词云(英文) 3.中文词云(分词 ...

  7. 海词词典—浏览器划词助手使用教程

    通过简单的设置就可以在非海词网站上使用划词助手,让您的学习阅读更加广泛化. IE浏览器添加方法                 Chrome浏览器添加方法 Firefox浏览器添加方法         ...

  8. Python生成中文词云图(一):可指定特定的词云形状和颜色。

    Python生成中文词云图 什么是词云? 首先,什么是词云呢?词云又叫文字云,是对文本数据中出现频率较高的"关键词"在视觉上的突出呈现,形成关键词的渲染形成类似云一样的彩色图片,从 ...

  9. linux c 内存分配函数

    1.void *alloca(size_t size),用来配置size个字节的内存空间,和mallac/calloc不同的是,alloca是从栈空间(stack)中配置内存,因此在函数返回时会自动释 ...

最新文章

  1. 基于python物流管理系统毕业设计-Python程序设计实验报告二
  2. mysql启动warning: World-writable config file
  3. java链表交集并集,一个链表求集合并集交集的异常
  4. Docker启动MySql后连接报1251处理方法
  5. 传感器信号处理仿真实验(c语言实现),均值滤波,滑动滤波
  6. (一)KitJs瀑布流组件特点
  7. 基于JAVA+SpringMVC+Mybatis+MYSQL的家校通管理系统
  8. 鸿蒙系统空城计,鸿蒙系统到底什么时候用在手机上?
  9. 深度优先搜索(DFS)与广度优先搜索(BFS) -- 总结
  10. java/php/net/python题库管理系统设计
  11. 微信小程序获取后端数据
  12. SwiftUI学习笔记之@State, @Binding
  13. nofollow标签使用方法
  14. 常用格式如何互相转换(jpg转png)
  15. 计算机图形学上机实验一-画出一个钻石
  16. 晶体谐振器和晶体振荡器的优缺点分析
  17. JIL Widget应用开发必读
  18. 【react】全选复选框和单个复选框联动功能
  19. WAMPServer3.1.4集成环境的下载(最新版)
  20. 一套键盘鼠标跨电脑切换使用

热门文章

  1. 学习加密(四)spring boot 使用RSA+AES混合加密,前后端传递参数加解密(方式一)
  2. 盒子科技笔试Java_丰巢科技 Java高级笔试面试题 PDF 下载
  3. 银河麒麟自带PyCharm
  4. 发现苹果的MacOS支持图片OCR文字识别
  5. 网页插入全屏背景视频
  6. 大白话chatGPT GPT的发展区别
  7. MATLAB运用——计算三维物体的质心(水花号)
  8. 单片机实验说明<二>外部中断基本使用
  9. 滁州学院第二期计算机,欢迎加入—学生会(第二期)
  10. thirteen day(冒泡排序')