本文介绍了静态编译语言可以代替脚本语言吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设您可以获得动态解释器;静态编译语言可以代替脚本语言吗?我从未完全理解为什么有人会使用脚本语言? 我所说的是在PC上,而不是一个需要简单化解释器的有限系统.我看到了一些python安装脚本,并且看到了类似的python和C#解决方案.那么为什么要使用脚本语言呢?

Assuming you can get a dynamic interpreter; can statically compiled languages replace scripting language? I never quite understood why anyone would use a scripting language? I am talking about on PC, not a limited system which needs a simplistic interpreter. I seen some python install scripts and seen similar python and C# solutions to a problem. So why use a scripting language?

注意:有些事情使我对C#感到困扰,我不是在问为什么不使用C#.我在问为什么要使用脚本语言?我发现静态编译语言更容易调试,并且通常更容易编码.

NOTE: There are things that bother me about C#, i am not asking why not use C# instead. I am asking why use a scripting language? I find static compiled languages much easier to debug and often easier to code in.

推荐答案

如今,编译和解释之间几乎没有区别.查看解释语言的执行方式-第一步是将脚本转换为某种内部可执行形式,例如可以由更简单的指令集执行的字节码.这实质上是编译为虚拟机格式.这正是现代编译语言所做的.而且,当将已编译的语言部署在服务器端Web应用程序中时,它们甚至可以从源代码中即时进行重新编译.因此,在编译/执行技术方面几乎没有区别.

There is very little distinction these days between compiling and interpreting. Look at how an interpreted language is executed - the first step is to convert the script into some kind of internal executable form, like byte code that can be executed by a simpler instruction set. This is essentially compilation to a virtual machine format. This is exactly what modern compiled languages do. And when compiled languages are deployed in server-side web apps, they even recompile from the source on the fly. So there's practically no difference in terms of the compile/execute technique.

唯一的区别在于指令集的详细信息,特别是在类型系统中.脚本语言通常(但并非总是)是动态类型的.但是,许多大型应用程序也都使用动态类型的语言编写.同样,这里没有明显的区别.

The only difference is in the details of the instruction set, specifically in the type system. Scripting languages are usually (but not always) dynamically typed. But many large applications are also written in dynamically typed languages too. So again, there is no clear distinction here.

我个人认为静态打字远不是额外的不必要的工作"(经常被描述),它实际上是一个巨大的生产力提升器,这要归功于智能感知/自动补全功能,使得在初次尝试时正确地编写简短的代码片段要容易得多. .为了强调这一点,请看一下Microsoft如何通过简单地向其添加静态类型信息(以特殊格式的注释)来改进jQuery库,以便我们可以在IDE中具有智能感知功能.

Personally I think static typing, far from being "extra unnecessary effort" (as it is often described) is actually a huge productivity booster, making it much easier to write short snippets correctly on the first attempt, thanks to intellisense/autocompletion. To underline this, look at how Microsoft has improved the jQuery library simply by adding static type information to it (in specially formatted comments) so we can have intellisense in the IDE.

同时,静态语言(包括C#和Java)引入了更多的动态键入功能.

And meanwhile, static languages (including C# and Java) are bringing in more dynamic typing features.

因此,我认为这些类别最终会合并在一起,并且区分毫无意义.

So I see these categories as eventually merging and the distinction being meaningless.

这篇关于静态编译语言可以代替脚本语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 15:51