编辑程序“正在运行”?怎么样? [英] Editing programs “while they are running”? How?

查看:151
本文介绍了编辑程序“正在运行”?怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题是必然结果:编辑程序而他们正在运行?为什么?

This question is a corollary to: Editing programs "while they are running"? Why?

我最近才接触到Clojure的世界,并且被 a 少数 示例我看到的实时编码。上面讨论的问题讨论了为什么。

I'm only recently being exposed to the world of Clojure and am fascinated by a few examples I've seen of "live coding". The question linked above discusses the "why."

我的问题是:如何它是clojure语言的一个特征,使它成为可能吗?或者,它只是一个他们应用的模式,可以应用于任何语言?我有一个背景在python和java。

My question is: How is this live coding technique possible? Is it a characteristic of the clojure language which makes it possible? Or is it just a pattern that they applied which could be applied to any language? I've got a background in python and java. Would it be possible to "live code" in either of these languages like it is possible in clojure?

推荐答案

有些语言实现有可能很长时间以来,尤其是许多Lisp变体和Smalltalk。

Some language implementations have that for a long time, especially many Lisp variants and Smalltalk.

Lisp将标识符作为数据结构,称为符号。这些符号可以重新分配,并在运行时查找。这个原理称为后期绑定。符号名称函数和变量。

Lisp has identifiers as a data structure, called symbols. These symbols can be reassigned and they are looked up at runtime. This principle is called late binding. Symbols name functions and variables.

此外,Lisp实现在运行时有一个解释器甚至是一个编译器。接口是函数 EVAL COMPILE 。另外还有一个函数 LOAD ,允许加载源代码和编译代码。

Additionally Lisp implementations either have at runtime an interpreter or even a compiler. The interface are the functions EVALand COMPILE. Plus there is a function LOAD, which allows loading of source code and compiled code.

Lisp有一个对象系统,允许更改类层次结构,类本身,可以添加/更新/删除方法,并将这些更改传播到已经存在的对象。因此面向对象的软件和代码可以自己更新。使用元对象协议甚至可以在运行时重新编程对象系统。

Next a language like Common Lisp has an object system which allows changes to the class hierarchy, classes themselves, can add/update/remove methods and propagates these changes to already existing objects. So the object-oriented software and code can be updated itself. With the Meta-object Protocol one can even re-program the object system at runtime.

这也很重要的Lisp实现然后可以垃圾收集删除代码。这样,运行的Lisp不会因为代码被替换而在运行时大小上增长。

It's also important that Lisp implementations then can garbage collect removed code. That way the running Lisp will not grow in runtime size just because code is replaced.

Lisp通常还有一个错误系统,它可以从错误中恢复,在调试器内。

Lisp often also has an error system which can recover from errors and allows replacing defective code from within the debugger.

这篇关于编辑程序“正在运行”?怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆