闭合和对象 [英] closures and objects

查看:172
本文介绍了闭合和对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

函数式编程就像经典( Mark Twain的类型)。
在阅读关于SICP的另一篇文章时,人们谈论的是
,这对我的思考产生了巨大的影响,我想起了这个,我以前读过的

Functional programming .. is like classic ( Mark Twain's type). While reading another articles about SICP, where people are talking about the great impact closures had on there thinking, i got reminded of this, which i read ages ago

关闭是穷人的对象
对象是可怜的人的关闭

Closures are poor man's objects Objects are poor man's closure

(不能记住确切的源,但它是程序员rosetta石头,或编程的禅宗,
或编程的tau ... google已经变得如此拥挤,不能去原始来源)

( Can't recall exact source but it was programmers rosetta stone, or zen of programming, or tau of programming ... google has become so crowded that can't go to original source )

程序员...你的采取...
是关闭的东西,你总是缺少..或只是一些语法糖,
一个预处理器可以做!

So co-programmers ... What is your take ... are closure something that you were always missing .. or just some syntactic sugar, which a preprocessor can do !!

推荐答案

http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html


那位尊敬的高手Qc Na正和他的学生安东一起走。希望到
提示主人讨论,安东说大师,我听说
对象是一件很好的事 - 这是真的吗? Qc Na看起来很可惜,他的学生
回答说:愚蠢的学生 - 对象只是一个穷人的
关闭。

The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."

他从他的主人离开,回到他的牢房,
意图学习闭包。他仔细阅读了整个Lambda:The
Ultimate ...系列文章及其表兄弟,并实现了一个小型的
Scheme解释器和一个基于闭包的对象系统。他学到了很多,而
期待着告诉他的主人他的进步。

Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.

安东尼在下一次和Qc Na一起散步时,试图用
说大师,我勤奋地研究这个问题,现在理解
的对象是真正的穷人的关闭。 Qc Na用他的棍子敲打
Anton,说:你什么时候学习?闭合是一个穷人的
对象。在那一刻,安东变得开明。

On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.

- Anton van Straaten

-- Anton van Straaten

这篇关于闭合和对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆