(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43360287

这个Hacker News讨论围绕着一个提案展开,该提案建议将编程语言分组为“语言集”,并实现自动化的外部函数接口(FFI)和序列化/反序列化。核心思想是不同的语言用于不同的任务(前端、后端、系统),导致胶水代码方面的挑战。一种统一的方法将允许同一语言集内的语言之间无缝通信,例如Rust、RustScript和RustGC。 评论者指出,当前添加类型系统(如TypeScript到JavaScript,为Python添加类型)的趋势是一种变通方法。他们建议设计更易于编译的语言,以克服解释器(如CPython的FFI)带来的限制。一位用户分享了他们使用C结构体和`cffi`来提高Python性能的经验,这反映了为SQL访问定义良好数据模型的概念。另一位用户表示支持为Rust添加自动垃圾回收(GC)。

相关文章
  • 从语言到语言集 2025-03-17
  • (评论) 2024-07-16
  • (评论) 2025-03-14
  • (评论) 2024-09-19
  • (评论) 2024-08-01

  • 原文
    Hacker News new | past | comments | ask | show | jobs | submit login
    From Languages to Language Sets (gist.github.com)
    19 points by whatever3 4 hours ago | hide | past | favorite | 4 comments










    One thing I'll note is we tend to use languages from different levels in different settings (front end, back end, systems) and we spend an awful lot of time writing glue code to get them to talk to each other.

    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).



    Back when I did some high perf Python, I’d define my data at C structs and bump allocate those structs in a list using the cffi.

    It is not unlike defining your data model for SQL so that you can have sane data access.





    I’m a strong supporter of adding an automatic GC to Rust. Although it seems difficult to justify as RustGC code wouldn’t be trivial to convert to traditional Rust. But going in the opposite direction should be trivial.






    Join us for AI Startup School this June 16-17 in San Francisco!


    Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



    Search:
    联系我们 contact @ memedata.com