- 论坛徽章:
- 0
|
回复 111# starwing83
乱了……看来是我用词不够清楚。
好吧,先顺着你原来那楼说。
从这个定义看出来,identifier是variable的组成部分之一。而identifier是expression,即variable的组成部分之一可以作为expression。即variable可以作为expression使用。
这段话的问题:
引文说A variable name in computer source code is an identifier,也就是说,在源代码中variable name是identifier。或者说,variable name的集合是identifier的集合的子集。这里并没讲到variable和identifier的直接关系,所以我想你认为variable name是variable的组成部分。
其实这里逻辑上仍然不通——引文可没说An identifier must be a variable什么的,事实上也存在不是variable name的identifier(就C而言,如直接构成function designator的identifier,俗称function name)。不过我想应该都明白要讨论的是作为variable name的identifier,所以之后按下不提。
言归正传:
其实说白了,形式(变量名)和内容(变量或者变量的值)的关系,一哲学问题。
In computer programming, a variable is a storage location and an associated symbolic name which contains some known or unknown quantity or information, a value. The variable name is the usual way to reference the stored value; this separation of name and content allows the name to be used independently of the exact information it represents.
这里说的associated symbolic name是讨论variable概念中不可回避的一个要素,如果不讲是不完整了——这点也是反对LZ杜撰的anonymous variable的理由。引文讨论的一个显著前提是不忽略这里任何一个要素。
但是注意这里的name是associated而不是contained,和content/value的地位有着显著的不同。最重要的区别在于,变量名依赖于变量,变量不依赖于变量名。实际上,如果不考虑具体语言的限制,你可以抽象地声称存在具体的“某个变量”而不关心它的变量名(你不关心值具体是什么,不打算引用变量,只是说明这个值需要通过变量来维持存在);但要说不和任何变量关联的具体的“某个变量名”是没什么意义的(在C里面顶多就是还没被用来声明变量的标识符而已,和变量扯不上什么进一步的关系)。
接下来是最大的问题:
即便变量总是无条件地包含变量名,那又能说明什么?变量就是变量名?还是变量名就是变量?
|
|