语法糖
来源:互联网 发布:全息投影 知乎 编辑:程序博客网 时间:2024/04/29 13:51
语法糖是指在计算机语言中添加的某种语法,这种语法对功能并没有影响,只是更方便程序员使用。通常来说,使用语法糖可以增加程序的可读性,从而减少程序代码出错的机会。
对于Java语言来说,最常用的语法糖为泛型、可变参数、装箱、拆箱、循环遍历等,虚拟机执行时并不支持这些语法,它们在编译的阶段会还原回简单的基础语法结构,这个过程称为解语法糖。
In computer science, syntactic sugar is syntax within a programming language that is designed to make things easier to read or to express. It makes the language "sweeter" for human use: things can be expressed more clearly, more concisely, or in an alternative style that some may prefer.
For example, many programming languages provide special syntax for referencing and updating array elements. Abstractly, an array reference is a procedure of two arguments: an array and a subscript vector, which could be expressed as get_array(Array, vector(i,j))
. Instead, many languages provide syntax like Array[i,j]
. Similarly an array element update is a procedure of three arguments, something like set_array(Array, vector(i,j), value)
, but many languages provide syntax like Array[i,j] = value
.
Specifically, a construct in a language is called syntactic sugar if it can be removed from the language without any effect on what the language can do: functionality andexpressive power will remain the same.
- 语法糖 语法盐
- 什么是:语法糖、语法盐、语法糖精
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- 语法糖
- OC简便语法 语法糖
- 语法糖(糖衣语法)
- OC中语法糖,最新语法总结
- OC中语法糖,最新语法总结
- C#语法糖
- Haskell 中的语法糖
- 二维码的生成与扫描
- ContentProvider 使用
- UISearchbar设置placeholder字体颜色大小
- javase面试题
- LintCode Remove Nth Node From End of List 删除链表中倒数第n个节点
- 语法糖
- Google+ 团队的 Android UI 测试
- Java集合之Collection和Map
- intellij下安装jrebel插件
- 我的第一篇博客--图片加载器
- JAVA字符串格式化-String.format()的使用
- 推迟绝经5-10年不是神话|思妍金巢安
- DB2 OLAP函数的使用(转)
- 深入探讨this指针