Literals are very common in C#. I want to know the philosophy and history of literals.
Funnily enough I am on the bus right now writing a blog entry about that exact topic. Look to my blog in the next couple of weeks for the whole article (assuming that I finish it.) But for now, here's a sneak peak.
The principal philosophical impact of string literals in programming languages is that they allow the developer to make a distinction between the mention and the use of a programming language structure. For example:
The quotation marks make a big difference. They mean "do not treat the thing inside the quotation marks as part of the program but rather as mere text that has no impact on the program qua the program".
To describe the full philosophical impact of the use-mention distinction would take many hundreds of pages; I recommend that you read "Godel Escher Bach" by Douglas Hofstadter; it is all about these sorts of philosophical explorations.
What is more interesting than string literals are what we might think of as "program literals"; that is "literals" that capture more complex structures than mere string values. Expression tree lambdas in C# 3 are such structures (though they are not usually referred to as "literals", really they logically are.) The history of the lambda literal goes back to the early days of Lisp, with its "quote" operator. I'll be discussing that at more length in my blog, so stay tuned.
发布评论
评论(1)
有趣的是,我现在正在公交车上写一篇关于这个主题的博客文章。请在接下来的几周内查看我的博客以获取整篇文章(假设我已完成)。但现在,这里是一个先睹为快的内容。
编程语言中字符串文字的主要哲学影响是,它们允许开发人员区分编程的提及和使用语言结构。例如:
引号有很大的不同。它们的意思是“不要将引号内的内容视为程序的一部分,而是仅视为对程序本身没有影响的文本”。
要描述使用-提及区别的完整哲学影响将需要数百页;我建议您阅读道格拉斯·霍夫施塔特(Douglas Hofstadter)的《哥德尔·埃舍尔·巴赫》(Godel Escher Bach);这都是关于这些类型的哲学探索。
比字符串文字更有趣的是我们可能认为的“程序文字”;这是“文字”,它捕获比单纯的字符串值更复杂的结构。 C# 3 中的表达式树 lambda 就是这样的结构(尽管它们通常不被称为“文字”,但逻辑上确实如此。) lambda 文字的历史可以追溯到 Lisp 的早期及其“引用”运算符。我将在我的博客中更详细地讨论这个问题,敬请关注。
Funnily enough I am on the bus right now writing a blog entry about that exact topic. Look to my blog in the next couple of weeks for the whole article (assuming that I finish it.) But for now, here's a sneak peak.
The principal philosophical impact of string literals in programming languages is that they allow the developer to make a distinction between the mention and the use of a programming language structure. For example:
The quotation marks make a big difference. They mean "do not treat the thing inside the quotation marks as part of the program but rather as mere text that has no impact on the program qua the program".
To describe the full philosophical impact of the use-mention distinction would take many hundreds of pages; I recommend that you read "Godel Escher Bach" by Douglas Hofstadter; it is all about these sorts of philosophical explorations.
What is more interesting than string literals are what we might think of as "program literals"; that is "literals" that capture more complex structures than mere string values. Expression tree lambdas in C# 3 are such structures (though they are not usually referred to as "literals", really they logically are.) The history of the lambda literal goes back to the early days of Lisp, with its "quote" operator. I'll be discussing that at more length in my blog, so stay tuned.