语法唐

来源:互联网 发布:windows优化大师打补丁 编辑:程序博客网 时间:2024/04/28 14:21
语法糖,直译自“syntactic sugar”,原指“语法中的糖分”。 
Beginning Regular Expression的译者李松峰先生有专文讨论: 

含糖语法,是由Peter J. Landin创造的一个术语,指的是为一门计算机语言的语法中添加的附加物或附加成分,它不会影响语言的功能,但却能使人类使用起该语言来”更甜美”一些。含糖语法为编程人员(对计算机规范语言来说,是设计人员)提供了一种编写程序(编写规范)的替代方式,这种方式更具有实用性、更有助于形成较好的程序设计风格,或者使代码读起来更自然。但是,它不会影响形式上的可表达性,也不会让语言拥有某种新功能。 

Syntactic sugar is a term coined by Peter J. Landin for additions to the syntax of a computer language that do not affect its functionality but make it “sweeter” for humans to use. Syntactic sugar gives the programmer (designer, in the case of specification computer languages) an alternative way of coding (specifying) that is often more practical, more conducive to a better programming style, or more natural to read. However, it does not typically affect the expressiveness of the formalism or permit the language to do something new. 

看来程序员还这会给自己解闷,呵呵
原创粉丝点击