News for hackers. Stuff that matters.
Re:Effective Rust by balder1991 on Thursday June 15, 2023 @10:32AM (#36341095)
I think there’s this concept in language theory that those speaking or writing strive for more complex concepts as it matches better their thoughts, while those receiving strive for more simplicity as it takes more energy to make sense of complex concepts (think about it as adapting the language to your audience).

But I think the main problem here is the famous debate of statically-typed languages vs dynamic ones. As statically-typed languages add more and more features to be more expressive, they have to work around the compiler limitations and create very bizarre syntaxes if they want to keep performance.

But maybe this is a tooling problem? What if we could see the code in a simpler way even if the actual code involves macros and templates?

Swift has just implemented macros that Xcode expand to show the generated code in a collapse/expand way, making it easy to understand what it does.

Re:Effective Rust by Firadeoclus on Thursday June 15, 2023 @01:14PM (#36343670)
This. Being able to expand macros lets you learn what it does in context, and once you're more familiar with the abstraction it gives you the benefit of hiding the details and highlighting the moving parts within an otherwise static structure.
Re:Effective Rust by dannymi on Friday June 16, 2023 @06:54AM (#36354484)
>But maybe this is a tooling problem? What if we could see the code in a simpler way even if the actual code involves macros and templates?

Intelllij Rust plugin does this.

    println!("Hello, world! {}", x);

    >Recursive expansion of println! macro:
    >{
    >    ::std::io::_print(IntellijRustDollarCrate::format_args_nl!("Hello, world! {}", x));
    >}