如果将所有实现都编译成字节码,Ruby真的是一种解释型语言吗? [英] Is Ruby really an interpreted language if all of its implementations are compiled into bytecode?

查看:100
本文介绍了如果将所有实现都编译成字节码,Ruby真的是一种解释型语言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在为

所有当前的Ruby 实现被编译为 字节码.与SAP的主张相反, 在Ruby 1.9中,MRI本身包括一个 字节码编译器,尽管具有该功能 将编译后的字节码保存到磁盘 在过程中的某个地方消失了 合并YARV虚拟机的过程. JRuby被编译成Java .class 文件.我没有很多细节 在MagLev上,但可以肯定地说 也会走那条路.

All of the current Ruby implementations are compiled to bytecode. Contrary to SAP's claims, as of Ruby 1.9, MRI itself includes a bytecode compiler, though the ability to save the compiled bytecode to disk disappeared somewhere in the process of merging the YARV virtual machine. JRuby is compiled into Java .class files. I don't have a lot of details on MagLev, but it seems safe to say it will take that road as well.

对于Ruby的编译/解释问题,我感到困惑.

I'm confused about this compilation/interpretation issue with respect to Ruby.

我了解到Ruby是一种解释型语言,这就是为什么当我将更改保存到Ruby文件中时不需要重新构建项目的原因.

I learned that Ruby is an interpreted language and that's why when I save changes to my Ruby files I don't need to re-build the project.

但是,如果现在所有的Ruby实现都已编译,那么说Ruby是一种解释语言还是很公平的吗?还是我误会了什么?

But if all of the Ruby implementations now are compiled, is it still fair to say that Ruby is an interpreted language? Or am I misunderstanding something?

推荐答案

是的,Ruby仍然是一种解释语言,或更准确地说,是Matz的Ruby解释器(MRI),这是人们在谈论Ruby时通常谈论的内容.仍然是口译员.只需在其中进行编译,就可以将代码缩减为比一次又一次地解释和重新解释同一代码更快的执行速度.

Yes, Ruby's still an interpreted language, or more precisely, Matz's Ruby Interpreter (MRI), which is what people usually talk about when they talk about Ruby, is still an interpreter. The compilation step is simply there to reduce the code to something that's faster to execute than interpreting and reinterpreting the same code time after time.

这篇关于如果将所有实现都编译成字节码,Ruby真的是一种解释型语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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