更改

删除1,449字节 、 2021年1月20日 (三) 16:32
第29行: 第29行:       −
 
+
在计算机程序设计中,自指发生在'''反射 reflection''' 中,程序可以像读取或修改其他数据一样读取或修改自己的指令<ref>{{cite web|last1=Malenfant|first1=J.|last2=Demers|first2=F-N|title=A Tutorial on Behavioral Reflection and its Implementation|url=https://web.archive.org/web/20170821214626/http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/malenfant.pdf|publisher=PARC|accessdate=17 May 2015}}</ref> 。许多编程语言在某种程度上支持反射,具有不同程度的表达能力。此外,在函数式编程中的递归(与数学递归关系式相关)中可以看到自引用,其中代码结构在计算过程中反向引用自身<ref name="Drucker2008">{{cite book |last=Drucker |first=Thomas |title=Perspectives on the History of Mathematical Logic |url=https://books.google.com/books?id=R70M4zsVgREC&pg=PA110 |date=4 January 2008 |publisher=Springer Science & Business Media |isbn=978-0-8176-4768-1 |page=110}}</ref> 。把自指从潜在的矛盾概念“驯服”到良好的行为递归一直是计算机科学的伟大成功之一,现在经常被 “元语言”机器学习用于编写编译器。使用编译器编译其自身被称为 bootstrapping。无论是使用汇编语言还是使用Lisp 之类的函数式语言,编写让程序可以进行自修改的程序都是可能的,但在实际编程中通常不提倡这样做。计算器硬件使用了触发器中的自指,触发器是数字存储器的基本单位, 它随时间推移扩展条件,存储潜在的逻辑自相关矛盾。自指思维在程序员文化中普遍存在,许多程序和首字母缩略词都是以自指的方式命名,这是一种幽默的形式,比如 GNU (“ GNU 不是 Unix”)和 PINE (“ PINE 不是 Elm”)。GNU Hurd 是以一对相互自我指涉的缩写命名的。
 
  −
In computer programming, self-reference occurs in reflection, where a program can read or modify its own instructions like any other data. Numerous programming languages support reflection to some extent with varying degrees of expressiveness. Additionally, self-reference is seen in recursion (related to the mathematical recurrence relation) in functional programming, where a code structure refers back to itself during computation. 'Taming' self-reference from potentially paradoxical concepts into well-behaved recursions has been one of the great successes of computer science, and is now used routinely in, for example, writing compilers using the 'meta-language' ML. Using a compiler to compile itself is known as bootstrapping. Self-modifying code is possible to write (programs which operate on themselves), both with assembler and with functional languages such as Lisp, but is generally discouraged in real-world programming. Computing hardware makes fundamental use of self-reference in flip-flops, the basic units of digital memory, which convert potentially paradoxical logical self-relations into memory by expanding their terms over time. Thinking in terms of self-reference is a pervasive part of programmer culture, with many programs and acronyms named self-referentially as a form of humor, such as GNU ('Gnu's not Unix') and PINE ('Pine is not Elm'). The GNU Hurd is named for a pair of mutually self-referential acronyms.
  −
 
  −
在计算机程序设计中,自指发生在'''反射 reflection''' 中,程序可以像读取或修改其他数据一样读取或修改自己的指令<ref>{{cite web|last1=Malenfant|first1=J.|last2=Demers|first2=F-N|title=A Tutorial on Behavioral Reflection and its Implementation|url=https://web.archive.org/web/20170821214626/http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/malenfant.pdf|publisher=PARC|accessdate=17 May 2015}}</ref> 。许多编程语言在某种程度上支持反射,具有不同程度的表达能力。此外,在函数式编程中的递归(与数学递归关系式相关)中可以看到自引用,其中代码结构在计算过程中反向引用自身<ref name="Drucker2008">{{cite book |last=Drucker |first=Thomas |title=Perspectives on the History of Mathematical Logic |url=https://books.google.com/books?id=R70M4zsVgREC&pg=PA110 |date=4 January 2008 |publisher=Springer Science & Business Media |isbn=978-0-8176-4768-1 |page=110}}</ref> 。把自指从潜在的矛盾概念“驯服”到良好的行为递归一直是计算机科学的伟大成功之一,现在经常被 “元语言”机器学习用于编写编译器。使用编译器编译其自身被称为 bootstrapping。无论是使用汇编语言还是使用Lisp 之类的函数式语言,编写让程序可以进行自修改的程序都是可能的,但在实际编程中通常不提倡这样做。计算器硬件使用了触发器中的自指,触发器是数字存储器的基本单位, 它随时间推移扩展条件,存储潜在的逻辑自相关矛盾<。自指思维在程序员文化中普遍存在,许多程序和首字母缩略词都是以自指的方式命名,这是一种幽默的形式,比如 GNU (“ GNU 不是 Unix”)和 PINE (“ PINE 不是 Elm”)。GNU Hurd 是以一对相互自我指涉的缩写命名的。
   
[[File:Tupper's self -referetial formula.jpg|400px|right|thumb| Tupper自指公式的Wolfram实现,图像与公式本身一致 ]]
 
[[File:Tupper's self -referetial formula.jpg|400px|right|thumb| Tupper自指公式的Wolfram实现,图像与公式本身一致 ]]