Hacker News (curated)new | past | comments | ask | show | jobs| show hidden

Aside: one Zig (syntax) feature that I really missed in Rust is shown in the second code block, namely prefixed multi-line string literals à la:

    const text =
        \\This is a long comment
        \\But I can split it among lines arbitrarily
        \\And keep my indentation.
    ;
I've started using the Rust macro library `docstr` [1], which does the same thing:

    const TEXT: &'static str = docstr!(
        /// Now I can do it in Rust, too.
        /// I prefer this style a lot of the time
        /// for long texts.
    );
It even works with macros (example from the docs):

    let greeting: String = docstr!(format!
        /// Hello, my name is {name}.
        /// I am {} years old!
        age
    );
1. https://docs.rs/docstr/latest/docstr/


In C you can do that.

   printf ("Things:\n"
     " thing1=%u\n"
     " thing2=%u\n"
     " thing3=%u\n",
        thing1,
        thing2,
        thing3);



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