寻找一种同时支持解释和本机编译模式的新语言

发布于 2024-10-08 08:23:17 字数 261 浏览 3 评论 0原文

我目前使用 Perl、Python、C#、C、C++、Java 和其他一些语言进行编程,并且我正在寻找一种新语言作为进行个人项目时的主要语言。

我当前的标准是:

  • 可以作为解释语言运行(即无需等待编译即可运行);
  • 可以编译为本机代码;
  • 是强类型的(即使是可选的);
  • 支持宏/模板/代码变形/你想调用它的wtf;
  • 有相当数量的库,或者很容易访问它;

有想法吗?建议?

I currently program in Perl, Python, C#, C, C++, Java, and a few other languages, and I'm looking for a new language to use as a primary when doing personal projects.

My current criteria are:

  • can be run as an interpreted language (i.e., run without having to wait to compile it);
  • can be compiled to native code;
  • are strongly typed (even if optionally);
  • support macros/templating/code morphing/wtf you want to call it;
  • has a decent number of libraries for it, or easily accessible to it;

Ideas? Suggestions?

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

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

发布评论

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

评论(3

甜宝宝 2024-10-15 08:23:17

我建议 Haskell 适合您的标准。

  • 可以作为解释语言运行吗?是的,通过 GHCI。
  • 可以编译为本机代码吗?是的。
  • 是强类型的吗?非常如此。甚至可能是当今最强类型的语言,除了像 Agda 这样的定理证明器。
  • 支持宏/模板/变形吗?如果你使用模板 haskell.然而,这是该语言的可选扩展,因此大多数库不使用宏。我自己没有使用过 Haskell 模板,所以我无法评论它是否有任何好处。
  • 有像样的图书馆支持吗?标准库还不错。还有 Hackage,一个有点 CPAN 风格的 Haskell 库的开放存储库。

此外,听起来您已经了解很多命令式/面向对象语言。恕我直言,如果你学习另一种语言。它可能是您在其他地方已经看到的功能的稍微不同的排列。将函数式编程等另一种编程范例添加到您的工具箱中可能会是更好的学习体验。不过我想这是否是一个优势取决于你是否想学习新事物或快速提高工作效率。

I would suggest that Haskell suits your criteria.

  • Can be run as an interpreted language? Yes, via GHCI.
  • Can be compiled to native code? Yes.
  • Is strongly typed? Very much so. Perhaps even the most strongly typed language today, with the exception of some theorem provers like Agda.
  • Support macros/templating/morphing? If you use template haskell. This is an optional extension of the language however, so most libraries don't use macros. I haven't used template haskell myself so i can't comment on if it's any good.
  • Has decent library support? The standard library is not bad. There is also Hackage, an open repository of Haskell libraries a bit in the style of CPAN.

Additionally, it sounds like you already know a lot of imperative/object oriented languages. IMHO if you learn another one of those langs. it will probably be a slightly different permutation of features you've already seen somewhere else. Adding another programming paradigm like functional programming to your toolbox will probably be a better learning experience. Though I guess whether that's an advantage or not depends on if you want to learn new things or be productive quickly.

一向肩并 2024-10-15 08:23:17

Common Lisp 适合:有可选的类型,可以使用高效的本机编译,强大的 REPL 使其成为脚本编写的完美选择,并且有强大的宏元编程。

OCaml 也适合使用 CamlP4 进行元编程。

Common Lisp fits: there is an optional typing, efficient native compilation is available, powerful REPL makes it a perfect choice for scripting, and there is a powerful macro metaprogramming.

OCaml fits as well, with CamlP4 for metaprogramming.

望喜 2024-10-15 08:23:17

斯卡拉?它确实运行脚本,尽管它们首先被编译(透明地)。我不确定你所说的代码变形等是什么意思,但这对于 DSL 来说非常好。它满足您的所有其他要求 - 与 Java 一样编译,强类型,并且拥有合理数量的自己的库以及所有 Java 的库。我还是个初学者,但到目前为止我很喜欢它。

Scala? It does run scripts, although they are compiled (transparently) first. I'm not sure what you mean by code morphing etc, but it's pretty good for DSLs. It meets all your other requirements - compiled as much as Java is, strongly typed, and has a reasonable number of its own libraries as well as all of Java's. I'm still a beginner with it, but I like it so far.

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