• 3 Posts
  • 3 Comments
Joined 3 years ago
cake
Cake day: August 29th, 2023

help-circle
  • Thank you for letting me know your thoughts!

    Automatic semicolon inference has a very big language footprint, similar to the range syntax that the author disliked.

    Maybe not “very big”, but I agree with your point in principle.

    The reason why I think it is worthwhile (compared to e. g. range syntax) is that we are paying for it anyway already:

    Good error reporting hinges on parsing not strictly the language that’s defined, but understanding the language that people actually write – and people forget ; all the time.

    So from my POV I’m turning an error reporting step (that I’d have to implement anyway) into something more useful.

    For this feature to be useful, it has to be at least powerful enough to replace format!

    To be honest, if all the fancy formatting stuff requires a macro, so be it.

    I just don’t want to need macros for creating a list and so on.




  • 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
      instead put different targets into different folders: much easier, works better
    • async should not exist at all
      (though not related to annotations vs. modifiers, but because the whole idea is a language design dead-end)


    So the code from your example would literally be …

    fun some_func: Unit = {
        var my_var = 3u2
        // ...
    

    … in my design.

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