用 Ada 编写的 Erlang?

发布于 2024-07-25 19:11:05 字数 403 浏览 1 评论 0 原文

另一个线程引用了这句话

  • Erlang VM BEAM 和 HiPE 大部分是用 C 编写的。
  • 链接驱动程序主要用 C 语言编写。(它们插入到 VM 并提供与外界的沟通 世界。)
  • 我读过一些观点,认为 Ada 的强类型、模块化、运行时检查、并行处理等都比 C 更好。

    使用 Ada 编译的 Erlang 会比用 C 编译的 Erlang 明显好还是差 ?

    只是一个假设的Q。

    Another thread had this quote

    1. Erlang VM BEAM and HiPE is written mostly in C.
    2. Linked-in drivers are written mostly in C. (They are plugged to VM
      and serves communication with outside
      world.)

    I've read some opinions that Ada's strong typing, modularity, run-time checking, parallel processing etc. etc. are better than that of C.

    Would Erlang compiled using Ada be noticably better or worse than the Erlang made with C?

    Just a hypothetical Q.

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

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

    发布评论

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

    评论(3

    柠檬 2024-08-01 19:11:05

    通常我会在这样的话题上向你抛出一堆狡猾的话,但事实证明这个问题正是已研究过(这是一个 .doc 文件。抱歉)。

    Rational 有一个编译器,其中包含大量两种语言的代码,以及多年来编译的有关错误率、修复时间等的大量数据。出于好奇,他们的一位工程师处理了这些数字。

    答案是“C 的开发成本超过 Ada”。 如果您阅读摘要标题,您会发现他们认为用 Ada 编写相同的代码的成本大约是用 C 编写代码的一半。

    我知道每个读到这篇文章的人都急于找出这个结论的漏洞。 我也是。 但他们几乎从我在报告中能想到的每一个角度进行了考察。

    Normally I'd throw a bunch of weasel-words at you on a topic like this, but it turns out this exact question has been studied (it's a .doc file. Sorry).

    Rational had a compiler with a large amount of code in both languages, and a large amount of data compiled over several years on bug rates, fix times, etc. Out of curiosity, one of their engineers crunched the numbers.

    The answer was "Development Costs of C Exceed Those of Ada". If you read past the summary title, you'd see that they figured writing the same code in Ada cost them about half what writing it in C cost.

    I know that everyone reading this is anxious to poke holes in that conclusion. I was too. But they looked at darn near every angle I could think of in the report.

    素食主义者 2024-08-01 19:11:05

    “更好”在什么方面? 更好更快吗? 错误越少越好吗? 更好,更便携? 更好的是更具可读性吗? 更好的可扩展性?

    对于“更好”的任何合适的定义,可以通过任何一种方式进行论证。 然而,没有任何编译语言比 C 更可移植,这是神圣的令状。因此,如果您的目标之一是使您的应用程序高度可移植,那么 C 是一个很好的选择。

    了解 C 的人多于了解 Ada 的人。 如果用 Ada 编写,那么编写 erlang 扩展可能会困难得多,因为熟悉该语言的人较少。

    C 代码可以具有高性能,但我知道 C 和 Ada 之间没有针对编译器优化的比较。

    Ada 的类型检查可能有用,也可能是一个真正的问题。 人们假设虚拟机会对对其重要的部分进行自己的类型检查。 Ada 中 RTTC 的开销可能会带来完全不必要的负担。

    "Better" in what way? Better as in faster? Better as in less bugs? Better as in more portable? Better as in more readable? Better as in more extensible?

    For any suitable definition of "better" arguments can be made either way. However, it is just about sacred writ that no compiled language is more portable than C. Thus, if one of your goals is to make your application highly portable, C is an excellent choice.

    More people understand C than Ada. Writing erlang extensions might be much harder if it was written in Ada, simply because fewer people are conversant with the language.

    C code can be highly performant, but I am aware of no comparisons between C and Ada w/r to compiler optimizations.

    Ada's type checking might be useful, or it could be a real problem. One presumes that a VM does it's own type checking on the pieces that matter to it. The overhead of RTTC in Ada could impose a completely unnecessary burden.

    GRAY°灰色天空 2024-08-01 19:11:05

    也许吧,但是您的 Ada 编译器是用什么语言编写的? 艾达? 编写您的第一个 Ada 编译器的编译器怎么样?

    在构建软件时的某些时候,形式语义和软件流程比用什么语言编码要重要得多。

    Perhaps, but what language was your Ada compiler written in? Ada? What about the compiler that write your FIRST Ada compiler?

    At some point when you are building software, formal semantics and software processes are much more important than what language something was coded in.

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