Should r values be expressions which evaluate to an expressed value or a storable value?

只谈情不闲聊 提交于 2019-12-13 02:55:46

问题


Essentials of Programming Languages says

References are sometimes called L-values. This name reflects the association of such data structures with variables appearing on the left-hand side of assignment statements. Analogously, expressed values, such as the values of the right-hand side expressions of assignment statements, are known as R-values.

while https://course.ccs.neu.edu/csg111/lectures/lec06.html from a course based on the book says

References are sometimes called L-values because the left side of an assignment should evaluate to a reference. Storable values are sometimes called R-values because the right side of an assignment should evaluate to a storable value.

I was wondering which one is correct? Specifically, should the right side of an assignment be expressions which evaluate to an expressed value or a storable value?

It makes more sense to me that the right side of an assignment must be expressions evaluated to storable value, because I think r-values are to be stored in locations by assignment statements. But the book seems more authoritative than the course note, up to possible typos.

I notice that the book says that

The storable values in a language are typically, but not always, the same as the expressed values of the language. This choice is part of the design of a language

but it doesn't say it is "always".

The question here helps to verify my possibly incorrect intutition a storable value is a denoted value.

For the definitions of expressed values and storable values, see the book and also the first quote in another post

来源:https://stackoverflow.com/questions/57469201/should-r-values-be-expressions-which-evaluate-to-an-expressed-value-or-a-storabl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!