comp.lang.lisp Fight on the Meaning of Closure
This page is a collection of posts by me (Xah Lee) of a thread on newsgroup comp.lang.lisp, on a subject of “closure”. The original thread can be seen at:
“comp.lang.lisp” Date: Fri, 2 May 2008 01:31:18 -0700 (PDT) Subject: A question (confusion) about closure Source groups.google.com
Xah Lee wrote: What is Closure in Programing Language .
I don't quite understand what you were saying, perhaps largely due to your use of Common Lisp and jargons specific to it.
If you would, defend your thesis using plain English with good effort at technical writing, or perhaps with emacs lisp code, then we can start a debate.
If you think hard about closures, as if turning the concept into a mathematical definition (aka formalization or codification), and further, if you like, take a survey of say the top 10 major langs, about their concept of closure (if any), further, then i think you'll agree, that what i said about closures is perfect. Note the word _perfect_ here. Its not _approximately right_, nor _helpful analogy_, nor _insightful_. Perfect.
I am perfect.
You and Rainer, are the epitome of what i'd call the tech geeking morons (or just “tech geekers”), in my eyes. That's the type of people in computing industry, who can't see the gist of things, the context of things, the purpose of things, but perpetually bury their heads deep in technical obscurity.
(one quick way to picture this class of folks is to think of linuxers, in the context of software usability (imagine, the worst scenario, if your grandma calls in tech support asking about some problems with the computer, and a tech geeker on the other end is yelling about jumpers and drivers and kernel space running out of patience, quite frustrated and aghast at the level of ignorance and stupidity of people in the world))
This class of folks, typically are slightly above average programers, and some are academics. Most have been in the industry for a while. Also, a significant percentage of them are a subset of studious computer science college studs. Put it in another way, these tech geekers are a certain subset of elite programers, who pride in calling themselfs “hackers”.
The tech geekers, their thinking and views are inline with orthodox wisdom. They are also keen with the latest thoughts and trends, and pride themselfs in this fact of fashionability. However, they have very little ability in creativity, or perspicacity. Their IQ is often above average, but typically are not outstanding. Also, their ability to analyze mathematically is low, possibly below average among their intellectual peers. They never possess the acumen typical of a mathematician.
However, a notable ability of tech geekers, is their tolerance for dense, incomprehensible, obscure, technicalities. (perhaps that's is also why they are good in their profession: coding) Specifically, the ability to drill down dense technical details, often at the expense of forgetting, discarding, or not understanding the context, whole design, or original purpose. More often than not, a hallmark of their foolhardiness caused by their tech drilling propensity, is that they often create the most unusable software.
I have posted here actively for a month or so few months back. You knew me, i knew you, we knew each other to some degree. So, instead of starting another perhaps ultimately tiresome and useless argumentation here about some computer science or programing subject, i thought i'd write something else, just to be fresh, about what i think of your cohorts as a class.
The usenet newsgroup comp.lang.* hierarchy, are in fact a mecca for this tech geeker class i speak of. In contrast, the tech geekers are also almost never mathematicians, inventors, scientists. (For that matter, nor ever sociologists, historian, good philosopher, or great writers. O, and never artists of any standing.) I think a good alternative epithet to convey the characteristics of this class of people, is: Engineers. Of the nerdy, uncreative, brute force, ones. Another tech geeker who was a regular here comes to mind. His name is Christopher. I wrote of him, in 2001, here: Unix And Literary Correlation .
It's deja vu all over again.
I feel like i'm a genius, even though i'm really not, but now it appears here, there are 4 against me now, and who are these 4 people? they are (mostly) experienced lisp programers.
If there are 4 lisp programers, most or all of which i think are experienced, and all claim that i was wrong, how can i be right?
(Laughs out loud to myself a nervous laugh)
So, logic dictates, that i'm a real genius, that my thoughts are, as they say, beyond the times, transcends the common.
At this point, i have maybe 2 choices. (1) to continue my aloof existence, and keep exuding heightened phantasmagorical writings. (2) be down to earth, and explain in earnest, technically, my positions in a humble way, with the consequences of (A) utterly proven myself to be the biggest idiot who made a big splash but shown to be wrong, in the end. (B) proven my detractors wrong, and hence earns the admiration and respect with mystic qualities.
This is a dire decision to make. I seem to be unable to make this decision. Could this be a false dichotomy?
I'm guessing my problem has to do with my personality. A normal person, would probably just discuss the issue in earnest. Like, we all human beings, some knows some areas better, and we all make mistakes. A discussion can just carry on in its course, and everyone can just learn something or simply enjoy the chat.
But Noooo! I can't be like that. People have wronged me. Not because i'm wrong, because they are cocks (and comparatively stupid?). Look at Rainer's reply to my message, he called me FUD!! He called me FUD, everybody! Look there!!!
He sayz: “Fortunately there is [a definition of “closure”]. You just have to look it up.”.
Now that tone is not pleasant on the ear! I said “There is no universal definition of the concept of closure in the context of programing languages.” and he retorted me and denied me the pleasure to be correct!
He continues: “Closures have nothing to do with global vars. Your attempt to explain it does not help.”.
Woot! Perhaps his writing skill at the precision aspect needs improving, but i don't think my writing claimed that “closures has to do with global vars” (nay, i knew i didn't). He sayz my attempt to help didn't help. He sullied me! I got sullied. Wrongfulness accused. Incompetence of fact-checking charged. I got WRONGED AND SULLIED. DENIED the pleasure of helping! A fundamental pleasure of life, denied to me, by one tech geeker.
I refused to believe this, and i kindly told Rainer that he should think about the issue, to formalize the concept, to take a survey, and i'm perfect. Now, one George tech geeker ganged on me and propound that i'm a “perfect imbecile”!
Witnesses, you have seen the above. The sequence of affairs is not unlike a pack of dogs barking for supremacy. I imagine i still have the upper hand though.
Still, it troubles me deeply, how could a patently simple explanation, a simple concept, a penetrating view, be not clearly grasped by a gaggle of lispers? In this thread, there are 15 messages. Not one reply, seems to indicate that what i said is correct. Almost half of them actually pointed out that i was incorrect, and even unhelpful. I'm greatly troubled by this. To me, this is like going into a bar, and when the subject of 1+1 comes up, my nonchalant remark of 2 suddenly made everybody stare. This can be a terrifying experience. Like, in a bar you suddenly realized all the people around you are aliens. Or, you realized it's a gay bar and you are not gay. Or, they are all black and you are the only white. Or, you are standing out like a sole genius.
Suppose, in such a situation, you have some choices. A rational one, is to calmly explain, in earnest, your views. And, you think, truth will prevail. But nuuuuu! What if they will have none of it? I mean, for all you know, these aliens might be cannibals. And remember, you are out numbered. Just imagine, 50 bucks on a doe; the lord of the flies. A alternative course of action, is to ply the art of subterfuge. Feign left and right, give a smile and a nod. Acknowledge, that 1+1 can be 3, under the circumstances. Tech geek with them. Win a friend.
Sirs, would you like to have a piece of my mind?
I'm rather quite surprised how my exposition of the closure concept turn up so many messages, many claiming it being even unhelpful or useless. And now, Kent Pitman, the rhetoric master, began his verbose elaboration with my name repeatedly embedded. (i feel, rather, elated by that) (lol)
In the beginning, 'was just Rainer and George Neuner. Their problem, is simply not seeing the over all picture, but drilling on Common Lisp technicality and terminology. I point this out but, but as i said, sometimes something so obvious and clear to me but can't get other programers to see. (lisp's cons and list problem, is another example, we've discussed at length around Jan) Robert Maas came in too. So silly.
People, closures is effectively just function using global vars, alright?
You want functions to share env? create a naming scheme like _contextA_var1, _contextA_var2, … then functions can share _contextA_* vars.
You want 2 different env? have it _contextA_*, _contextB_* … etc.
You want nesting? Have it _contextA_ContextA_*…, _contextA_ContextB_*…, _contextA_ContextA_ContextA*, _contextA_ContextA_ContextB*, etc.
No, the prefix “_” isn't alluding to Python's object whatnot or anything. It just any random string as a naming convention so it could be programmatically identified and hidden from user. (think how you would implement closure)
In this way, you have closures, or what closures is supposed to achieve in a program, in just about any language.
Closures, function with a state, OOP, are basically the same thing. They just have slightly different perspective, slightly different connotation, and defined and implemented differently in different langs.
When you formalize them into mathematics, they amount to the same thing.
People, stop tech geeking. Get ya heads out of sand. Stop drilling on definitions and terminologies, or burying yourself deep inside Common Lisp. The original poster of this thread is perhaps asking about terminologies in CL context and i hijacked the thread to discuss the concept of closure itself in general. At least i wished you could see that.
The Kent fella is a pest. He is the circular priest. Writes long and carefully, and very difficult to deal with. Whatever he didn't like, will become the lamb to be put up for slaughter when the time comes.
The Rainer fella insists his posting of Common Lisp code as a way to put the discussion on firm grounds. What a meritable fellow. Try Emacs Lisp Rainer, or Mathematica. If you have a question on the latter, i can help you.
Tim, shuddap and go do your school work.
Kenny!!!!!! I saw your vid on google. On the beach babbling about the wonders of Common Lisp. You crazy!!!!
Dear Stefan and all,
If you could, put out a snippet of code of closure, in emacs lisp. I'll show how it is done with global vars.
Common Lisp is fine but i don't know Common Lisp.
For good or bad, i'd like to reiterate here: folks, closures are effectively just function using global vars. This, is the most clear statement capturing the heart of closure, and illustrating it in a background practically all modern computer languages can understand.
It is just one perspective, not the only way. It isn't a correct description if taken from the perspective of history. It isn't a sensible description from the perspective of implementation. But from semantic point of view, with a touch of education and pragmatics, it is perfect.
Stefan N wrote: «A closure is, to try a more formal, mathematical definition, an object consisting of two components: a function body (the code) and an accompanying environment (just a bunch of data). …»
Yeah. Now, that accompanying env, can be the global env. One just need to partition it so as to become several envs with a identification scheme. One simple to illustrate way, is by tagging id to the var names. (folks, was this so hard to understand? was this so deep a concept that required me like 5 painful messages in one-upmanship to clarify? Recall, Rainer began, by calling me FUD! That's FEAR, UNCERTAINTY, and DOUUUUUUUBT!!!)
Effectively, a closure is just language feature that allow users to create subroutines that works as a state machine. Alternatively, a closure feature that would give a subroutine a paper and pen, where it can write down values and remember it.
Global vars is one big piece of paper folks. Share!
For a good, fresh, simple, explanation of the semantic essence, of many jargons and concepts in computing esp those associated with OOP, see: What are OOP's Jargons and Complexities .
Read the above, and you'll come away with a clarity, of the mathematical essence of many jargons and concepts you hear all day, like never before.
If nobody can show a snippet of emacs lisp code of closure for me to tear down, then i demand 3 public posts of this content: Xah Lee is beautiful.
PS soliloquy to myself: gosh, i so hate tech geekers. The dumb, fat, stupid, ugly, common, plebeian, asses. Slaving around the world all day, just to contradict me and pull me down. O, this reminds me, Friedrich Nietzsche wrote about Master-slave morality. Yeah, the slaves of the world. Catch heart attack!!!!!
On May 6, 12:57 am, Didier wrote:
Emacs Lisp is probably the worst Lisp dialect ever. You shouldn't try to learn Lisp from Emacs Lisp…
I started to read comp.lang.lisp since 1998. I don't actually read it that much, but usually in periodic bursts, perhaps few times a year, few weeks per bout, i'd come in and read a lot, sometimes post too.
Thru the years, i have come to know quite a few regulars or notables. For example, Erik Naggum, Kent Pitman, Kenny Tilton, Rainer Joswig, Rob Warren, Ron Garret (aka Erann Gat), at least 3 Christophers (Christophe Rhodes, Christopher C Stacy, Christopher Browne), Tims Bradshaw, 2 Pascals (Costanza, Bourguignon), Mark Tarver, Brian Harvey, William Clinger, Dorai Sitaram, Richard Fateman, Duane Rettig, Richard Gabriel, David Lamkins, Barry Margolin, Jon Harrop, Coby Beck, Joe Marshall, Nils Goesche, Thomas F Burdick, Raymond Wiker, Paul Rubin… and many more (won't be bothering to put full effort to make a listful here… )
Some have come and gone, as is the ways of newsgroup and life. Not that i love them all. Some i read, some i swear off, many i have exchanged missives. In general, it was fun. I wish them well. When next time i have nothing to do i shall write a brief of Who's Who of comp.lang.lisp, detailing each's deeds, persona, trivia. Certainly, it can function as a bible of who is knowledgeable, who is dense, who is theoretical, who is practical, who is frank, who is tact, who is technical, who is theatrical, who is got logorrhea, who is man of few words.
However, you seem to have crawled out of the woodwork into my awareness today. May i ask, your credential please?
As a way of introduction of myself, perhaps i can show you this essay of mine: The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations .
Regarding your contemplation and regurgitation on the issues of modernization of emacs lisp, and or emacs vs xemacs, please you peruse:
Regarding your patronizing concern and officious advice of learning Common Lisp, you might want to be acquainted with the knowledge that i have no interest in learning Common Lisp whatsoever.