Skip to content

RFC: Simplify attribute syntax #11141

Closed
Closed
@glaebhoerl

Description

@glaebhoerl

Instead of

#[attr1, attr2(foo)]

write

#attr1 #attr2(foo)

in other words, instead of a list of attributes delimited by [], # would introduce a single attribute, and multiple attributes would be written as multiple single attributes.

This is less busy visually, especially when there's only one attribute, which is common. In terms of character count it requires 1 character for a single attribute (vs. 3 with the current syntax), and 2 additional characters for each additional attribute (same as the current syntax).

And it looks like hashtags, which is cute and not a bad intuition.

I don't know why the syntax is the way it is right now: historically, I think it's probably because macros were originally #foo() rather than foo!()? But I don't see any other potential for conflict in today's syntax. (The only other place the # character is even used, as far as I know, is raw strings.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions