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