编程语言设计的良好资源?

时间:2022-11-01 11:37:31

Javascript: The Good Parts is a great book. Often I find myself reading passages like the following from the perspective of a language designer:

Javascript:The Good Parts是一本很棒的书。我经常发现自己从语言设计师的角度阅读以下段落:

undefined and NaN are not constants. They are global variables, and you can change their values. This should not be possible, and yet it is. Don't do it.

undefined和NaN不是常量。它们是全局变量,您可以更改它们的值。这应该是不可能的,但事实确实如此。不要这样做。

Takeaways:

  1. Don't change the value of undefined in my Javascript code.
  2. 不要在我的Javascript代码中更改undefined的值。

  3. When designing a language, make its equivalent of undefined immutable.
  4. 在设计语言时,使其等效于undefined immutable。

A different more subtle example would be "for in shouldn't enumerate over prototype properties".

一个不同的更微妙的例子是“for in in should not enmerate over prototype properties”。

I want a book at talks about these issues of language design outside of the context of a particular language.

我想要一本关于特定语言背景之外的语言设计问题的书。

If you were trying to design the "perfect" OO language, what books would you read for guidance?

如果您试图设计“完美”的OO语言,您会阅读哪些书籍作为指导?

5 个解决方案

#1


8  

The web site 'lambda the ultimate' is very much about programming languages, and they occasionally have some good resources, although they tend to be more interested in academic kinds of things. Functional programming is big there, for instance.

网站“lambda the ultimate”非常关注编程语言,它们偶尔会有一些很好的资源,尽管它们往往对学术类型的东西更感兴趣。例如,功能编程很重要。

http://lambda-the-ultimate.org/node/3

http://lambda-the-ultimate.org/papers

http://lambda-the-ultimate.org/node/492

#2


6  

You could take a page from the same place as Java, Ruby, Objective C, and others and check out Design Priciples Behind Smalltalk. Much of this is foundational material on communication between objects, rather than anything about Smalltalk specifically.

您可以从与Java,Ruby,Objective C等相同的位置获取页面,并查看Smalltalk背后的设计原则。其中大部分是关于对象之间通信的基础材料,而不是具体的Smalltalk。

As far as really thoughtful books on langauge design, I think The Design and Evolution of C++ definitely deserves a mention. I hesitate since you say that you want the "perfect" OO language, and C++ is far from perfect. You could probably still learn a lot from it, though.

至于关于语言设计的真正有思想的书籍,我认为C ++的设计和演变绝对值得一提。我犹豫,因为你说你想要“完美”的OO语言,而C ++远非完美。不过,你可能还是可以从中学到很多东西。

The points you bring up, though, seem like they have more to do with the Principle of Least Astonishment or the Rule of Least Surprise than with the design of language internals.

然而,你提出的观点似乎与“最小惊讶原则”或“最小惊喜规则”有关,而不是与语言内部设计有关。

#3


4  

The Design and Evolution of C++ is good.

C ++的设计和演变很好。

Object-Oriented Software Construction is too.

面向对象的软件构建也是如此。

They are rather language-specific (C++, Eiffel), but there are lots of language-agnostic lessons.

它们特定于语言(C ++,Eiffel),但有很多与语言无关的课程。

#4


1  

You could check out the design documents of  Perl6

您可以查看Perl6的设计文档

Perl6 Synopsis

If you read Synopsis 6, you will find out that the addition operator is named:

如果您阅读了概要6,您会发现添加运算符的名称为:

  • infix:<+>
  • infix:«+»
  • infix:<<+>>
  • infix:{'+'}
  • infix:{"+"}

Which means you can create your own operators:

这意味着您可以创建自己的运算符:

sub postfix:<!> ($n) { [*] 1..$n }

#5


0  

There are great books explaining the design principles applied in widely used languages, but if you really want to "understand" the design principles you should dig deeper. I would surely recommend "Design concepts in programming languages" by franklyn turbak. This book tries to systematically explore programming language concepts based on it's mathematical foundations.

有很多书籍解释了广泛使用的语言中应用的设计原则,但如果你真的想要“理解”设计原则,你应该深入挖掘。我肯定会推荐franklyn turbak撰写的“编程语言中的设计概念”。本书试图系统地探索基于它的数学基础的编程语言概念。

#1


8  

The web site 'lambda the ultimate' is very much about programming languages, and they occasionally have some good resources, although they tend to be more interested in academic kinds of things. Functional programming is big there, for instance.

网站“lambda the ultimate”非常关注编程语言,它们偶尔会有一些很好的资源,尽管它们往往对学术类型的东西更感兴趣。例如,功能编程很重要。

http://lambda-the-ultimate.org/node/3

http://lambda-the-ultimate.org/papers

http://lambda-the-ultimate.org/node/492

#2


6  

You could take a page from the same place as Java, Ruby, Objective C, and others and check out Design Priciples Behind Smalltalk. Much of this is foundational material on communication between objects, rather than anything about Smalltalk specifically.

您可以从与Java,Ruby,Objective C等相同的位置获取页面,并查看Smalltalk背后的设计原则。其中大部分是关于对象之间通信的基础材料,而不是具体的Smalltalk。

As far as really thoughtful books on langauge design, I think The Design and Evolution of C++ definitely deserves a mention. I hesitate since you say that you want the "perfect" OO language, and C++ is far from perfect. You could probably still learn a lot from it, though.

至于关于语言设计的真正有思想的书籍,我认为C ++的设计和演变绝对值得一提。我犹豫,因为你说你想要“完美”的OO语言,而C ++远非完美。不过,你可能还是可以从中学到很多东西。

The points you bring up, though, seem like they have more to do with the Principle of Least Astonishment or the Rule of Least Surprise than with the design of language internals.

然而,你提出的观点似乎与“最小惊讶原则”或“最小惊喜规则”有关,而不是与语言内部设计有关。

#3


4  

The Design and Evolution of C++ is good.

C ++的设计和演变很好。

Object-Oriented Software Construction is too.

面向对象的软件构建也是如此。

They are rather language-specific (C++, Eiffel), but there are lots of language-agnostic lessons.

它们特定于语言(C ++,Eiffel),但有很多与语言无关的课程。

#4


1  

You could check out the design documents of  Perl6

您可以查看Perl6的设计文档

Perl6 Synopsis

If you read Synopsis 6, you will find out that the addition operator is named:

如果您阅读了概要6,您会发现添加运算符的名称为:

  • infix:<+>
  • infix:«+»
  • infix:<<+>>
  • infix:{'+'}
  • infix:{"+"}

Which means you can create your own operators:

这意味着您可以创建自己的运算符:

sub postfix:<!> ($n) { [*] 1..$n }

#5


0  

There are great books explaining the design principles applied in widely used languages, but if you really want to "understand" the design principles you should dig deeper. I would surely recommend "Design concepts in programming languages" by franklyn turbak. This book tries to systematically explore programming language concepts based on it's mathematical foundations.

有很多书籍解释了广泛使用的语言中应用的设计原则,但如果你真的想要“理解”设计原则,你应该深入挖掘。我肯定会推荐franklyn turbak撰写的“编程语言中的设计概念”。本书试图系统地探索基于它的数学基础的编程语言概念。