您的位置:首页 > 其它

Programming in Scala (Second Edition) 读书笔记27 注解

2014-12-15 13:59 399 查看
Annotations are 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 have structure, thus making them easier to machine process.
注解是附加到源码的结构化信息,就像注释,散布在程序的各个地方。注解可以被附加的任何变量
,方法,表达式或其它程序元素。但是不像注释,注解是有结构的,所以可以很容易被机器理解
元编程的任务:
1. Automatic generation of documentation as with Scaladoc.
2. Pretty printing code so that 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 are called meta-programming tools, because they are programs that take other programs as input. Annotations support these tools by
letting the programmer sprinkle directives to the tool throughout their source
code.
一其它程序作为输入的工具称为元编程工具,注解支持这类工具
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: