哪些语言是动态类型化和编译的(哪些是静态类型化和解释的)? [英] Which languages are dynamically typed and compiled (and which are statically typed and interpreted)?

查看:143
本文介绍了哪些语言是动态类型化和编译的(哪些是静态类型化和解释的)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在阅读有关动态和静态类型的文章时,我一直提出以下假设:编译静态类型的语言,而解释动态类型的语言.我知道总的来说这是对的,但是我对异常很感兴趣.

In my reading on dynamic and static typing, I keep coming up against the assumption that statically typed languages are compiled, while dynamically typed languages are interpreted. I know that in general this is true, but I'm interested in the exceptions.

我真的希望有人不仅给出这些例外的一些例子,还要尝试解释为什么决定这些语言应该以这种方式工作.

I'd really like someone to not only give some examples of these exceptions, but try to explain why it was decided that these languages should work in this way.

推荐答案

以下是一些有趣的系统的列表. 不是详尽无遗!

Here's a list of a few interesting systems. It is not exhaustive!

  1. The Gambit Scheme编译器, Chez Scheme ,Will Clinger的盗窃案编译器, Bigloo 方案编译器,可能还有很多其他编译器.

  1. The Gambit Scheme compiler, Chez Scheme, Will Clinger's Larceny Scheme compiler, the Bigloo Scheme compiler, and probably many others.

为什么?

很多人都非常喜欢Scheme.程序作为数据,良好的宏系统,35年的发展,庞大的社区.但是他们想要性能.因此,许多优秀的本机代码编译器-Chez Scheme甚至是一种成功的商业产品(解释后的字节码是免费的;您需要付费的本机代码).

Lots of people really like Scheme. Programs as data, good macro system, 35 years of development, big community. But they want performance. Hence, a number of good native-code compilers—Chez Scheme is even a successful commercial product (interpreted bytecodes are free; native codes you pay for).

用于 Lua 的LuaJIT即时编译器.

The LuaJIT just-in-time compiler for Lua.

为什么?

显示它可以完成.然后,人们开始喜欢他们的Lua程序,将它们的速度提高了3倍. Lua在很多游戏中都需要性能,而它在其他产品中也越来越流行. Adobe Lightroom中70%的代码是Lua.

To show it could be done. And then, people started to like getting 3x speedup on their Lua programs. Lua is in a lot of games, where performance matters, plus it's creeping into other products too. 70% of the code in Adobe Lightroom is Lua.

iconc 图标 -to-C编译器.

The iconc Icon-to-C compiler.

为什么?

使用它的五十个人喜欢图标.完全不寻常的评估模型,是设计过的最具创新性(我认为是最好的)字符串处理系统.但是这种评估模型确实非常昂贵,尤其是在1980年代后期的计算机上.通过将Icon编译为C,Icon Project使得大型Icon程序可以在更少的时间内运行.

The fifty people who used it loved Icon. Totally unusual evaluation model, the most innovative (and in my opinion, best) string-processing system ever designed. But that evaluation model was really expensive, especially on late-1980s computers. By compiling Icon to C, the Icon Project made it possible for big Icon programs to run in fewer hours.

结论:人们首先开发了一种动态类型语言的附件,并且可能是一个重要的代码库.最终,社区吐出了本机代码编译器,以便您可以获得更好的性能并解决更大的问题.

Conclusion: people first develop an attachment to a dynamically typed language, and probably a significant code base. Eventually, the community spits out a native-code compiler so that you can get better performance and solve bigger problems.

此类别较不常见,但是...

This category is less common, but...

  1. 目标骆驼. ML的方言,语言设计创新实验的许多工具.

  1. Objective Caml. Dialect of ML, vehicle for lots of innovative experiments in language design.

为什么?

非常便携的系统,编译时间非常快.人们都喜欢这两种属性,因此新的语言设计思想被广泛传播.

Very portable system and very fast compilation times. People like both properties, so the new language-design ideas are desseminated widely.

莫斯科ML.标准ML,具有模块系统的一些额外功能.

Moscow ML. Standard ML with a few extra features of the modules system.

为什么?

便携,快速的编译时间,易于进行交互式的读取/评估/打印循环.成为流行的教学编译器.

Portable, fast compilation times, easy to make an interactive read/eval/print loop. Became a popular teaching compiler.

C-Terp.我认为可能是来自Gimpel Software的旧产品. Saber C—一种我认为您无法再购买的产品.

C-Terp. An old product, I think maybe from Gimpel Software. Saber C—a product I don't think you can buy any more.

为什么?

调试.特别是在MS-DOS下对1980年代硬件进行调试.仅需很少的资源,您就可以在非常有限的硬件上调试C代码获得非常好的帮助(请考虑:带有8位总线的4.77MHz处理器,满载640K RAM).对于本地编译的代码,要获得好的可视化调试器几乎是不可能的,但是有了解释器,这相当容易.

Debugging. Especially, debugging on 1980s hardware under MS-DOS. For very little resources, you could get really good help debugging C code on very limited hardware (think: 4.77MHz processor with an 8-bit bus, 640K of RAM fully loaded). Nearly impossible to get a good visual debugger for native-compiled code, but with the interpreter, fairly easy.

UCSD Pascal—该系统使"P-code"成为家喻户晓的单词.

UCSD Pascal—the system that made "P-code" a household word.

为什么?

教师喜欢Niklaus Wirth的语言设计,并且编译器可以在很多小型计算机上运行.沃思的简洁设计和UCSD P系统完美结合,而Pascal是1970年代的标准教学语言.年轻人可能很难理解,在1970年代,关于在第一门课程中教授什么语言的争论一直没有.今天,我知道了使用C,C ++,Haskell,Java,ML和Scheme的程序. 1970年代始终是Pascal,而UCSD P系统是一个重要原因.

Teachers liked Niklaus Wirth's language design, and the compiler could run on very small machines. Wirth's clean design and the UCSD P-system made an unbeatable combination, and Pascal was the standard teaching language of the 1970s. Younger people may find it hard to appreciate that in the 1970s there was no debate over what language to teach in the first course. Today I know of programs using C, C++, Haskell, Java, ML, and Scheme. In the 1970s it was always Pascal, and the UCSD P-system was a big reason way.

如果您想知道,P代表便携式.

In case you are wondering, P stood for portable.

摘要:解释静态类型的语言是一种将实现快速交付大家的好方法. (对于在青铜时代的硬件上进行调试,它也具有优势.)

Summary: Interpreting a statically typed language is a great way to get an implementation into everybody's hands quickly. (It also had advantages for debugging on Bronze Age hardware.)

这篇关于哪些语言是动态类型化和编译的(哪些是静态类型化和解释的)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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