[–] [S] 2 points 6 months ago

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.

  • source
  • parent
  • context
  • [–] 1 point 6 months ago

    It's layers and layers of indirections with no clear need and technical decisions that make things unnecessarily complex.

    So your basically writing Regexes in a custom DSL in JavaScript, combined with custom hooks written in C, from which a megabytes-large native-code parser is generated.

    The complexity of the solution does not fit the niche between dead-easy TextMate grammars and plugging into an LSP.

    Don't misunderstand me, I wish there was something filling that niche, but TreeSitter 100% certainly isn't it.

  • source
  • parent
  • context
  • [–] [S] 0 points 6 months ago* (last edited 6 months ago) (1 child)

    I spent the necessary effort to experiment/work with the various approaches to form an opinion, and your main counter argument is largely ... being sarcastic, trying the hardest to misunderstand things to ridicule them and being generally offended?

    Let's end this here, your comments are a poor use of my time.

  • source
  • parent
  • context
  • [–] [S] 0 points 6 months ago* (last edited 6 months ago)

    Ok, then here's a short answer to your points:

    Aesthetics. Annotations are just uglier than modifiers. Due to their special syntax instead of just a naked keyword.

    If the language has annotations already, then you have paid the tax of having "special syntax" in your language in any case.
    (Except Swift maybe, which has "attributes" and more than 200 keywords.)

    Annotations take up more space

    I don't consider this a drawback. In fact, many languages with modifiers have the same rules about modifier placement.
    I actually want annotations on their own line, such that all my actual keywords start at the same column.

    Disorder

    Many languages with modifiers have the exact same issue, and address the issue the same way I'd address it for annotations:
    Define a desired order of annotations and let the compiler/linter/IDE/formatter deal with it.

    Downgrading

    Let the IDE/editor pick a different color for you "more important" annotations, if you like.

    “your language should not have modifiers, do annotations instead” instead of “if your language has both, remove modifiers”

    That's just nitpicking the wording. Ok.

    Namespacing ... is not objectively better. I don’t want to import “public” in every single file.

    Then don't? Most languages don't make you import String either.

    Namespacing ... Or even worse, a non-annotation (function, class) named “public”.

    Have a separate namespace for for annotations, or treat @ as part of the name.
    Though it's not something I would spend effort on – sometimes the best answer to "X does not work" is "then don't".

    Variable declarations do have modifiers too (for example “const” in C).

    I replaced ...

    const foo: Foo = ...
    

    ... with ...

    @constantValue
    let foo: Foo = ...
    

    ... in my language a short while ago. It's fine.

  • source
  • parent
  • context
  • [–] [S] -1 points 6 months ago* (last edited 6 months ago) (3 children)

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

  • source
  • parent
  • context
  • view more: next ›