• teri@discuss.tchncs.de
    link
    fedilink
    arrow-up
    0
    ·
    24 days ago

    Generally seems an okay idea to me because it allows you to use the rust tool-chain and you can more easily achieve compatibility with other rust code. In fact, there’s other languages which do something similar. I remember F* (f-star) which compiles to OCaml.

  • Consti@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    24 days ago

    There’s many languages that started by compiling to C (including C++), so it’s an option. As another commenter has already said, it also means that you inherit everything of rust, which can be useful (borrow checker) but also tricky (language decisions, generate correct code). C is a much simpler language (in terms of features), so it’s easier to compile to, but Rust should be as doable.

  • mousetail@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    24 days ago

    It’s certainly possible.

    An type system can’t be both sound and cover all cases. Rust had made certain trade offs, and some weird edge cases regarding generic lifetimes still cause UB.

    If you compile to rust you’ll be forced to inherit all the decisions Rust had made over the years, and won’t be able to tune then to your use case. That may it may not be a problem for you.