原文
| ||||||||||
| ||||||||||
![]() |
原始链接: https://news.ycombinator.com/item?id=43360287
这个Hacker News讨论围绕着一个提案展开,该提案建议将编程语言分组为“语言集”,并实现自动化的外部函数接口(FFI)和序列化/反序列化。核心思想是不同的语言用于不同的任务(前端、后端、系统),导致胶水代码方面的挑战。一种统一的方法将允许同一语言集内的语言之间无缝通信,例如Rust、RustScript和RustGC。 评论者指出,当前添加类型系统(如TypeScript到JavaScript,为Python添加类型)的趋势是一种变通方法。他们建议设计更易于编译的语言,以克服解释器(如CPython的FFI)带来的限制。一位用户分享了他们使用C结构体和`cffi`来提高Python性能的经验,这反映了为SQL访问定义良好数据模型的概念。另一位用户表示支持为Rust添加自动垃圾回收(GC)。
| ||||||||||
| ||||||||||
![]() |
A major advantage of the proposed approach is automated FFI and serialization/deserialization between languages in the same language set. RustScript would be able to accept a struct or enum from Rust or RustGC, and vice-versa. You could have a channel with different languages on either end.
You can also see that we _want_ something like this, e.g. we bolt TypeScript on top of JavaScript, and types onto Python. If JavaScript (or python) were designed so they could be more easily compiled (notably, no monkey patching) then they would support level 2 as well.
I have been thinking of level 2 or 1 languages that support the higher levels. This is a really good framing. (The problem with going the other way is the implementation decisions in the interpretter often constrain how the compiler can work, e.g. CPython is dominant because all the libraries that make use of the CPython FFI, and similarly for NodeJS. It is easier to interpret a constrained language than to compile a dynamic language designed with an interpretter in mind).
reply