• socOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 小时前

    I believe that if you start from an annotation-only stance, then you will look at the language, its defaults and possible extensions differently, because annotations are “visually” more expensive than slapping yet-another keyword on something.

    I. e.:

    • “no” visibility modifier should probably mean “public”
    • defining the external API should move to the module-level altogether
    • we should probably use var instead of let mut
    • #[cfg(target_os = "windows")] is just bad design overall; put different targets into different folders: much easier, works better
    • async should not exist (though not related to annotations vs. modifiers, but because the whole idea is a language design dead-end)

    Rust’s syntax with #[...] is not that great in this regard, as it triples the amount of symbol involved for simple annotations compared to something using @....