问题描述
为什么他们不改变?
编辑:
问题原因是因为我是新来的emacs,我想使用Emacs作为程序员计算器。所以,我可以操纵32位& 64位整数,并且它们的行为与在本机上的行为一样。
The reason ask is because I'm new to emacs and I would like to use Emacs as a "programmer calculator". So, I can manipulate 32-bit & 64-bit integers and have them behave as they would on the native machine.
推荐答案
Emacs-Lisp是一种动态类型的语言。这意味着您需要在运行时输入标签。如果你想使用数字,你通常必须将它们打包成一些你可以指向的标签容器(即盒子),因为没有办法在运行时将指针与机器整数进行区分没有某种标签方案。
Emacs-Lisp is a dynamically-typed language. This means that you need type tags at runtime. If you wanted to work with numbers, you would therefore normally have to pack them into some kind of tagged container that you can point to (i.e. "box" them), as there is no way of distinguishing a pointer from a machine integer at runtime without some kind of tagging scheme.
出于效率原因,大多数Lisp实现因此不使用原始指针,但我认为称为描述符。这些描述符通常是单个机器单词,其可以表示指针,未装箱的数字(所谓的 fixnum )或各种其他硬编码数据结构之一(通常值得编码NIL和cons
For efficiency reasons, most Lisp implementations do therefore not use raw pointers but what I think is called descriptors. These descriptors are usually a single machine word that may represent a pointer, an unboxed number (a so-called fixnum), or one of various other hard-coded data structures (it's often worth encoding NIL and cons cells specially, too, for example).
显然,如果你添加了类型标签,那么你没有剩下完整的32位数,所以您将在MIT Scheme中留下26位,或在Emacs中使用29位,或者您没有用于标记的任何其他位数。
Now, obviously, if you add the type tag, you don't have the full 32 bits left for the number, so you're left with 26 bits as in MIT Scheme or 29 bits as in Emacs or any other number of bits that you didn't use up for tagging.
某些实现各种动态语言为fixnums保留多个标签,以便它们可以为您提供30位或甚至31位的修补程序。 SBCL是Common Lisp的一个实现,。不过,我并不认为这是因为Emacs而引起的并发症。您在多长时间需要快速的30位fixnum算法,而不是在文本编辑器中的29位fixnum算术,甚至没有将Lisp代码编译成机器代码(或者是吗?不记得了吗?您是否在Emacs-Lisp中编写了distributed.net客户端?更好地切换到Common Lisp,然后! ;)
Some implementations of various dynamic languages reserve multiple tags for fixnums so that they can give you 30-bit or even 31-bit fixnums. SBCL is one implementation of Common Lisp that does this. I don't think the complication that this causes is worth it for Emacs, though. How often do you need fast 30-bit fixnum arithmetic as opposed to 29-bit fixnum arithmetic in a text editor that doesn't even compile its Lisp code into machine code (or does it? I don't remember, actually)? Are you writing a distributed.net client in Emacs-Lisp? Better switch to Common Lisp, then! ;)
这篇关于为什么在Emacs中的fixnums只有29位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!