使用多种编程语言:有什么意义?
我已经查过了,但仍然找不到任何答案。
我指的是多语言编程,即使用多种编程语言来制作应用程序(我认为这是一个正确的定义)。
我只是想知道为什么你会同时使用 C++ 和 Java 之类的东西?
我知道它们有各自的优点和缺点,但实际意义是什么?这两者如何组合在一起相互协作?
I have looked this up and I still cannot find any sort of answer to this.
The thing I am referring to is Polyglot programming, which is the use of multiple programming languages to make an application (I think that's a correct definition).
I am just wondering why you would use something like C++ and Java together?
I am aware they have their advantages and disadvantages but what is the actual point and how would these two be put together to work with each other?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
多语言不是由多种语言组成的一个应用程序,它们是一个可以编译为有效的多种语言的源代码文本,而且它们几乎没有任何用途。
您可以根据自己的优势使用多种语言。例如,我可能会使用 C# 进行 GUI 工作和 WPF,这是一个出色的优势,但我可能会使用 C++ 来编写应用程序的核心,因为这就是它的优势。我可以用 C++ 编写 GUI,但这不是 C++ 的强项,而且我可以用 C# 编写我的核心算法 - 如果我可以对应用程序以及它的编写方式和执行方式几乎没有控制权,那么让执行需要更长的时间。
将两者结合使用意味着我可以拥有一个应用程序,该应用程序具有用 WPF 和 C# 编写的超棒可扩展 GUI,以及用 C++ 编写的强大、高性能的核心。
Polyglots aren't one application made of multiple languages, they're one source code text which compiles as valid multiple languages, and they pretty much don't have a use.
You use multiple languages for their individual strengths. For example, I might use C# for GUI work and WPF, which is an excellent strength, but I might use C++ to write the core of my application, because that's it's strength. I could write the GUI in C++ but that's not a strong point of C++, and I could write my core algorithms in C# - if I was OK to have little to no control over the application and how it was written and how it executes and let it take much longer to execute.
Using both together means that I can have an application with a sweet-ass extensible GUI written in WPF and C#, and a powerful, performant core written in C++.