Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Omit empty mapping constructors from annotations in the style guide #8928

Open
nipunayf opened this issue Apr 19, 2024 · 0 comments
Open

Omit empty mapping constructors from annotations in the style guide #8928

nipunayf opened this issue Apr 19, 2024 · 0 comments
Labels
Area/LearnPages Issues related to all the pages of the Learn section. Category/Content All written content related issues (Technical content, english language etc) Type/Improvement Improvements required on the website.

Comments

@nipunayf
Copy link
Contributor

Description

As specified in the spec https://ballerina.io/spec/lang/master/#section_9.1, the annotation value can be optional. Therefore, it is valid to write @test:Config for the following source code.

* If an annotation is empty, place it in a single line and
do not have spaces between both braces.
**Example,**
```ballerina
@test:Config {}
```

IMO, omitting the mapping constructor when the value is absent should be considered best practice since it simplifies writing and improves readability.

@nipunayf nipunayf added Type/Improvement Improvements required on the website. Area/LearnPages Issues related to all the pages of the Learn section. Category/Content All written content related issues (Technical content, english language etc) labels Apr 19, 2024
@nipunayf nipunayf changed the title Omit the braces for empty annotations in the style guide Omit empty mapping constructors fro annotations in the style guide Apr 19, 2024
@nipunayf nipunayf changed the title Omit empty mapping constructors fro annotations in the style guide Omit empty mapping constructors from annotations in the style guide Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/LearnPages Issues related to all the pages of the Learn section. Category/Content All written content related issues (Technical content, english language etc) Type/Improvement Improvements required on the website.
Projects
None yet
Development

No branches or pull requests

1 participant