通用脚本语言的使用

发布于 2024-08-19 06:18:47 字数 302 浏览 6 评论 0原文

有许多脚本语言社区声称该语言可以用于所有事情,但事实上,几乎每个人都将它用于一个特定的事情,例如:Web 开发。例如,如果我看一下 Ruby,他们会告诉您它是通用的,但实际上每个人都只将它与 Rails 一起用于 Web 开发。

  • 您能列出一些本地 PC 上流行的通用脚本语言的用法吗? (except embedding) Are there any?
  • 快速开发通常值得将整个解释器带入您的程序吗?然后在大多数情况下也会存在一些与语言相关的性能和稳定性问题..

最好的问候, 喇嘛

There are many scripting language communities claiming that the language can be used for everything but in fact, nearly everybody uses it for one specific thing, e.g.: web development. If I take a look at Ruby, for example, they tell you its general-purpose but actually everybody is using it with rails for web development only..

  • Can you list me some uses of popular general-purpose scripting languages for the local PC? (except embedding) Are there any?
  • Is the fast development usually worth having to bring the whole interpreter with your program? Then there would be some language-dependent performance and stability problems too in most cases..

best regards,
lamas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

慕烟庭风 2024-08-26 06:18:47

我倾向于使用 Python 来处理大多数不受计算限制的事情,即它们不受每秒执行的计算次数的限制。我使用 Python 做的一些事情是:

  1. 使用 Python Imaging 操作图像等的通用脚本图书馆
  2. 使用 pexpect 模块的命令行应用程序的 GUI 前端。
  3. 微生物系统的数学建模。
  4. 生物信息学。
  5. 一些网络编程。

等等...

当程序/算法受计算限制时,我将 C 与 Python 和 Ctypes 一起使用。这符合您对通用目的的定义吗?它对于各种应用程序当然很有用,但如果程序需要快速处理数字,则不适合。

稳定性:Python 2.5/2.6 坚如磐石。从来没有一次事故不是由于自蠢而造成的。

快速开发:这对我来说绝对值得。在大多数情况下,在我工作的领域,程序员的时间比处理器时间更有价值。如果我能在几天而不是几周内编写一个程序,我很乐意让它运行几个小时。

I tend to use Python for most things that aren't compute bound, i.e. they aren't restricted by how many computations you do per second. Some of the things I've used Python for are:

  1. General scripts to manipulate images etc. with the Python Imaging Library.
  2. GUI frontends for command line applications using the pexpect module.
  3. Mathematical modeling of microbial systems.
  4. Bioinformatics.
  5. Some web programming.

etc...

When the program/algorithm is compute bound, I use C together with Python and Ctypes. Does this fit your definition of general purpose? It's certainly useful for a wide variety of applications, but not suitable if the program needs to crunch numbers fast.

Stability: Python 2.5/2.6 is rock solid. Never had a crash that wasn't caused by self-stupidity.

Fast development: It's definitely worth it for me. For the most part, in the field where I work, programmer time is orders of magnitude more valuable than processor time. I'm quite happy to let a program run for hours if I can write it in a few days instead of a few weeks.

太阳公公是暖光 2024-08-26 06:18:47

我经常使用 PHP 来做以前使用 bat 文件做的事情。写起来容易多了。讽刺的是,从 subversion 源为我的 Web 应用程序创建可安装材料的部署脚本是用 PHP 编写的。

Python 在游戏社区中很流行。 EVE Online 是用 Python 编写的

I often use PHP for things that I used to use bat files for. Much easier to write. Ironically, the deployment scripts to create installable materials for my web apps from the subversion sources are written in PHP.

Python is popular in the gaming community. EVE Online is written in python.

鹿港巷口少年归 2024-08-26 06:18:47

声称它们可以用于所有用途,但我经常找不到任何示例

您的问题是基于错误的假设。尽管正如所指出的那样,图灵完备的语言将能够计算您所需要的内容……大多数语言被“视为”其最有用的功能和高效语义的总和。

现实是:

  1. 大多数脚本语言可以做同样的事情,或者通过库支持最常见的事情。
  2. 有些语言使一部分操作更方便,以 Perl 和正则表达式为例
  3. CPU 时间很便宜,RAM 也很便宜。对于大多数人来说,简单易懂的代码是首要任务。

脚本语言的兴起是很自然的。试图断言任何一种语言、方法或执行级别适用于一系列情况通常是徒劳的。

  1. 你想要什么?
  2. 最好的语言是什么?
  3. 是否足够快足够小?通常答案是肯定的

想象一下,你应该使用 Erlang,或者 C 而不是 Lisp,但尝试使用 Python,因为你认为所有语言都是平等的。然而,在大多数语言/平台中,您都可以在问题域中实现相同的目标,并且不同级别的问题取决于任务。

claiming that they can be used for everything but I often can't find any examples for that

You are basing your question on an incorrect assumption. Although, as pointed out, a Turing complete language will be able to compute what you require ... languages are 'viewed' by most as the sum of their most useful features and productive semantics.

The reality is:

  1. Most scripting languages can do the same things, or support the most common things via libraries.
  2. Some languages make a subset of operations more convenient, take Perl and regular expressions as an example
  3. CPU time is cheap, as is RAM. Simple to understand code is the priority for most people.

The rise of the scripting languages is natural. Trying to assert any one language, approach or level of execution is good for a range of situations is usually fruitless.

  1. What do you want?
  2. What is the best language for that?
  3. Is is fast enough or small enough? Usually the answer is yes

Imagine trying to use Python where you should be using Erlang, or C instead of Lisp because you thought all languages are equal. They aren't, even though, you can achieve the same things in a problem domain, in most languages/platforms with varying levels of ballache dependant on the task.

初雪 2024-08-26 06:18:47

我经常使用 ruby​​ 来完成其他人创建 bash/sh 文件的任务。我发现 Ruby 语法对于批处理任务以及许多其他类型的任务来说非常直观(这是我的 goto 语言)

Perl 对于 UNIX 中的一般脚本编写非常流行,例如有用 perl 编写的包管理器和网站以及维护脚本。

Python 在 Web 和应用程序中都非常流行。

VBA 因被滥用在 Access 中编写程序而流行,并且也曾广泛用于网站的 ASP(对吗?)

I often use ruby for what other people would create bash/sh files for. I find Ruby syntax intuitive for batch tasks along with a lot of other sorts of tasks(it's my goto language)

Perl is extremely popular for general scripting in unixes, such as there are package managers and websites and maintenance scripts written in perl.

Python is extremely popular for both web and application use.

VBA Is popular for being abused to write programs inside of Access, and also was once commonly used in ASP for websites (right?)

夜清冷一曲。 2024-08-26 06:18:47

没有人提到AppleScript!

哈哈,不严重的是,Perl 到处运行,默认安装在(几乎)任何 Unix 系列操作系统上(并且很容易在 Windows 上安装),并且对于将事物粘合在一起非常有用。如果您浏览一下 CPAN,您会发现它极其很一般-目的。 “瑞士军用电锯”本来是一种诽谤,但我很喜欢它。性能也很好,尽管它实际上并不重要。拉里·沃尔的目标是“让简单的事情变得简单,让困难的事情成为可能”。

好吧好吧,所以我仍然是一个粉丝,叹息。

Nobody mentioned AppleScript!

Hahah, no seriously, Perl runs everywhere, is installed by default on (almost) any Unix-family OS (and is easy to get on Windows), and is extremely useful for gluing things together. And if you browse a bit at CPAN you'll see that it's extremely general-purpose. "Swiss army chainsaw" was intended as a slur but I think of it fondly. Performance is good too, though it hardly ever actually matters. Larry Wall's goal was "make easy things easy and hard things possible".

OK OK, so I'm a fanboy still, sigh.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文