Clojure's stability: lessons learned
Posted 云E栈
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Clojure's stability: lessons learned相关的知识,希望对你有一定的参考价值。
There’s been some Programming Language Discourse lately, and I have some thoughts. It’s mostly centered around :
最近有一些编程语言话语,我有一些想法。它主要围绕:
I would put it simply: Clojure was designed by a thinker, who creates when he is away from the keyboard, not in front of it. When one releases and breaks the code in his head first, very few breaking changes are left for the public releases.
我会简单地说:Clojure是由一个思想家设计的,他在离开键盘时不会在它前面创造。当一个人首先释放并破坏他的头脑中的代码时,公共版本中只剩下很少的重大变化。
I think, regardless of this person being right or wrong, there’s an interesting question here. Let’s look at :
我认为,无论这个人是对还是错,这里都有一个有趣的问题。我们来看看:
From the perspective of a (fairly large-scale at this point) app developer: I find it great that Clojure places such emphasis on backwards compatibility. In general, migration to newer Clojure versions is completely painless.
从(此时相当大规模)应用程序开发人员的角度来看:我发现Clojure非常重视向后兼容性。一般来说,迁移到更新的Clojure版本是完全没有痛苦的。
The language has been designed by experienced and mature people and doesn’t go through “let’s throw everything out and start again” phases like so many other languages do.
这种语言是由经验丰富的成熟人士设计的,并没有像许多其他语言那样经历“让一切都重新开始”。
Clojure has a well-deserved reputation for stability. The argument is not about that, but about Clojure is so stable.
Clojure在稳定性方面享有当之无愧的声誉。争论与此无关,但关于Clojure是如此稳定。
Individuals and their greatness
个人和他们的伟大
A lot of people, like the original commentator, believe that Rich, the BDFL of Clojure, is responsible. I think Rich deserves a lot of credit, but at the same time, this explanation is a little bit too close to the “great man theory of history.” The Great Man theory was originally proposed in the mid 1800s by Thomas Carlyle, and goes something like this: “'the history of the world is but the biography of great men.”
像原始评论员一样,很多人都认为Clojure的BDFL负责人Rich。我认为Rich应该得到很多赞誉,但与此同时,这种解释与“伟人的历史理论”有点过于接近。“伟人”理论最初是由托马斯·卡莱尔在19世纪中期提出的。像这样的事情:“”世界的历史只不过是伟人的传记。“
Don’t get me started about Carlyle, who was a pretty terrible guy even in his own day. A lot of the alt-right, “Dark Englightenment”, and Neo-reactionary folks consider him a really important thinker, and that’s all I’ll say about that.
不要让我开始谈论卡莱尔,即便在他那个时代,他也是一个非常可怕的人。很多alt-right,“Dark Englightenment”和新反动的人都认为他是一个非常重要的思想家,而这就是我所说的。
What this is that Important Men make big decisions, and that the lives of the rest of us are irrelevant in the scheme of things. He cited people like Shakespeare, Martin Luther, and Napoleon. In Carlyle’s mind, history was changed by these men and them alone. The French Army didn’t win wars, Napoleon won wars.
这就是重要的人做出重大决定,而我们其他人的生活与事物的计划无关。他引用了像莎士比亚,马丁路德和拿破仑这样的人。在卡莱尔看来,这些人和他们独自改变了历史。法国军队没有赢得战争,拿破仑赢得了战争。
I tend to subscribe to the opposite, that is, “history from below,” or “a people’s history,” which emphasizes the army over Napoleon, the worker over the CEO. A critic of Carlyle’s, Herbert Spencer, said this:
我倾向于赞同相反的观点,即“从下面的历史”或“一个人的历史”,这强调了军队胜过拿破仑,这是首席执行官的工人。卡莱尔的评论家赫伯特斯宾塞说:
You must admit that the genesis of a great man depends on the long series of complex influences which has produced the race in which he appears, and the social state into which that race has slowly grown. … Before he can remake his society, his society must make him.
你必须承认,一个伟人的起源取决于一系列复杂的影响,这些影响已经产生了他所出现的种族,以及这种种族慢慢成长的社会状态。 ......在他重塑社会之前,他的社会必须要成就他。
That is, we have to look at historical context to see what created these changes, not just a few famous individuals.
也就是说,我们必须查看历史背景,看看是什么造成了这些变化,而不仅仅是少数知名人士。
Two sidebars here: first, Spencer is the person who coined the phrase “survival of the fittest.” Second, there is an irony in framing this particular philosophical debate about if individuals or history cause historical change by citing well-known opinions of two individual men. This idea was so popular, and still is, that it’s something many of us latch onto, sometimes subconsciously, even those who don’t believe it!
这里有两个侧边栏:首先,斯宾塞是创造“适者生存”这一短语的人。其次,通过引用两个人的众所周知的观点,对于个人或历史是否引起历史变迁这一特定的哲学辩论具有讽刺意味。男子。这个想法是如此受欢迎,现在仍然是,我们很多人都有时会潜意识地,甚至那些不相信它的人!
So, beyond Rich, who as I said before, does deserve a lot of credit… why might Clojure be so stable? I can think of three reasons. There may be more, but these are what comes to my mind.
所以,除了Rich之外,正如我之前所说的,确实值得信赖......为什么Clojure会如此稳定?我可以想到三个原因。可能会有更多,但这些是我想到的。
Clojure is a Lisp
Clojure是一个Lisp
First of all, Clojure is a Lisp. This has a wide array of reasons why stability is a bit easier than in other languages.
首先,Clojure是一个Lisp。这有很多原因使得稳定性比其他语言更容易。
The first is Lisps’ lack of syntax. Most languages have updates that introduces new syntax. As this grows larger and larger, the design space gets more and more constrained, making updates harder and harder. Lisps, on the other hand, rarely grow syntactically. Clojure has more syntax than most Lisps, but it still has far less syntax than non-Lisp languages.
首先是Lisps缺乏语法。大多数语言都有引入新语法的更新。随着这种越来越大,设计空间越来越受限制,使得更新变得越来越难。另一方面,Lisps很少在语法上成长。 Clojure比大多数Lisp具有更多的语法,但它的语法仍然远远少于非Lisp语言。
Another perspective of this is homoiconicity. This property means that “new syntax” for Lisps can be introduced through macros, and not through the base language. In most other languages, users cannot extend the language to provide new syntax, but in Clojure, they can.
另一个观点是同质性。这个属性意味着Lisps的“新语法”可以通过宏引入,而不是通过基本语言引入。在大多数其他语言中,用户无法扩展语言以提供新语法,但在Clojure中,他们可以。
Lesson: the smaller your core language, the more stable you can be.
课程:核心语言越小,您就越稳定。
Clojure is dynamically typed
Clojure是动态类型的
There are many, many, many ways to debate the virtues of static typing against those of dynamic typing. However, one area in which dynamically typed languages clearly win out, in my mind, is that they have a wider set of tools at their disposal to make changes without breaking code. This cuts both ways; they also make it much, much harder to know if you’ve broken code as well. Those are able to be mitigated through a variety of techniques, and we can argue about the tradeoffs here, but I think the possibility of advantage is plainly clear.
有很多很多方法可以讨论静态类型与动态类型的优点。然而,在我看来,动态类型语言明显胜出的一个领域是,他们可以使用更广泛的工具来进行更改,而不会破坏代码。这会削减两种方式;他们也很难知道你是否也破坏了代码。这些可以通过各种技术得到缓解,我们可以争论这里的权衡,但我认为优势的可能性显而易见。
Lesson: it can be easier to change a dynamic system than a static one. This is both good and bad, but for now we’re focused on the good.
课程:更改动态系统比静态系统更容易。这既好又坏,但现在我们专注于好事。
Clojure’s development is pretty slow
Clojure的发展非常缓慢
Clojure famously optimizes contributions around Rich and his process, at the expense of others. Debating this has been a real sore spot lately, and I don’t mean to pile onto this part of the discussion. I’m not interested in suggesting, in this blog post, if this is good or bad. I’m interested in the effects it has.
Clojure以牺牲其他人的利益为代价,优化了Rich及其流程的贡献。最近辩论这个问题一直是一个真正的痛处,我并不打算参与讨论的这一部分。我不想在这篇博客文章中建议这是好还是坏。我对它的效果很感兴趣。
If we ask , the answer is 1,957. If we look at , we get 138 commits. Clojure 1.9 was released December 8, 2017. Clojure 1.10 was released December 17, 2018. That’s 138 commits for that release, for a year.
如果我们问,答案是1,957。如果我们看一下,我们会得到138个提交。 Clojure 1.9于2017年12月8日发布.Clojure 1.10于2018年12月17日发布。这一版本共有138次提交,为期一年。
In contrast, , six weeks of development, Rust had 1,694 commits. that’s almost as many as Clojure has had in the last nine and a half years.
相比之下,经过六个星期的开发,Rust有1,694个提交。这几乎和Clojure在过去九年半里一样多。
Lesson: It’s much easier to keep things stable when you don’t change as often.
经验教训:当你不经常改变时,保持稳定要容易得多。
All of these factors tie into each other. Clojure doesn’t need to change as much, since the core language is a Lisp. When it does need to change, it has good tools at its disposal to change. Also, note that Rich was the one who made a lot of these decisions! He absolutely deserves credit for a job well done, even if I think that there are many other factors at play.
所有这些因素都相互关联。 Clojure不需要改变太多,因为核心语言是Lisp。当它确实需要改变时,它拥有可以随意改变的好工具。另外,请注意Rich是做出很多决定的人!即使我认为还有很多其他因素在起作用,他对于一份出色的工作绝对值得称赞。
Furthermore, ascribing this entirely to Rich makes it harder for other languages to learn good lessons from Clojure’s successes; they can’t just get a Rich. By digging in a bit deeper, we can apply these lessons a bit more broadly. Good language design requires taking a sober look at various tradeoffs, and making the best decision you can make, regardless if you’re a BDFL or part of a language design team.
此外,将这完全归咎于Rich使其他语言更难从Clojure的成功中吸取教训。他们不能只获得富人。通过深入挖掘,我们可以更广泛地应用这些课程。良好的语言设计需要清醒地审视各种权衡,并做出最佳决策,无论您是BDFL还是语言设计团队的一员。
以上是关于Clojure's stability: lessons learned的主要内容,如果未能解决你的问题,请参考以下文章