you are viewing a single comment's thread
view the rest of the comments
[–] 3 points 6 months ago (3 children)

What is this article? There is no author, and it is written as if it were an objective truth when it is clearly subjective.

There is no conclusion, it's just an introduction paragraph that says "do this, this is good design", followed by a pro-con analysis, and then the article just ends. Given that it has real drawbacks, you would think it would be more nuanced than "do this, this is good design".

Furthermore the analysis is not even complete. The only 2 drawbacks mentioned only affecting the developer of the language. And ignoring more obvious drawbacks that would affect the users of the language:

  • Aesthetics. Annotations are just uglier than modifiers. Due to their special syntax instead of just a naked keyword.
  • Annotations take up more space. Screen space is valuable, annotations usually are stacked vertically, which takes up a lot of vertical screen space. This is in order to mitigate their use of horizontal screen space by their syntax.
  • Disorder. Annotations are not ordered, which means they are harder to parse by a human. And if there is a wall of annotations, a human might miss an important one because it is surrounded by others that are just boilerplate.
  • "Downgrading" modifiers to annotations removes their perceived importance. Modifiers modify the class/function/whatever, annotations add to it. Usually, you can ignore annotations and just look at the modifiers. If modifiers are annotations, you have to read the annotations to filter which ones are important to you and which aren't. Which is harder to do due to the previous point "Disorder".
  • If annotations were objectively better than modifiers, the logical conclusion would be "your language should not have modifiers, do annotations instead" instead of "if your language has both, remove modifiers".
  • Namespacing is not objectively better. I don't want to import "public" in every single file. It's just useless boilerplate at that point. And some dependency might export their own "public". Or even worse, a non-annotation (function, class) named "public". If reserving keywords for modifiers is a concern, you can just prepend the uncommon ones with "__". Nobody is going to complain that they can't use the name "__readonly" because it's reserved.
  • Variable declarations do have modifiers too (for example "const" in C). Annotations are awful for variable declarations. See the point about screen space. Same for closures or code blocks.
  • source
  • hideshow 3 child comments
  • [–] [S] -1 points 6 months ago* (last edited 6 months ago) (2 children)

    You do not have to agree with every blog post found on the internet.
    I think you make a few good arguments, but you are way too angry for me to engage.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 2 points 6 months ago (1 child)

    I did not intend to sound angry. I was trying to do an honest review of this article. Since I did not consider it good at all.

  • source
  • parent
  • hideshow 1 child comment
  • [–] [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