Programming in Scala (Second Edition) Reading notes 27 annotations

Source: Internet
Author: User

Annotations is structured information added to program source code. Like

Comments, they can be sprinkled throughout a program and attached to any

Variable, method, expression, or other program element. Unlike comments,

They has structure, thus making them easier to machine process.

Annotations are structured information that is attached to the source code, like annotations, scattered across the program. Annotations can be attached to any variable

, a method, an expression, or other program element. But unlike annotations, annotations are structured so that they can be easily understood by the machine.

Meta-programming tasks:

1. Automatic generation of documentation as with Scaladoc.

2. Pretty printing code so it matches your preferred style.

3. Checking code for common errors such as opening a file but, on some

Control paths, never closing it.

4. Experimental type checking, for example to manage side effects or

Ensure ownership properties.

Such Tools is called meta-programming tools, because they is programs that take other programs as input. Annotations support these tools by

Letting the programmer sprinkle directives to the tool throughout their source

Code.

Other programs as input tools called meta-programming tools, annotations support such tools


Programming in Scala (Second Edition) Reading notes 27 annotations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.