You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"A path used as an expression context denotes either a local variable or an item.", and
"Path expressions that resolve to local or static variables are place expressions, other paths are value expressions.".
But it doesn't say how to get from an item or a local variable to a value or a place.
First, it should be saying that the path which makes up the expression is resolved in the value namespace.
Then it needs to cover each kind of entity that can appear in the value namespace, and explain how to use one to get a value or a place (and so also determine the expression's type).
For example:
for a function item, the type is the corresponding function item type and the value is that type's unique member
for a constant item, the type is the Type from the ConstantItem and the value is obtained by evaluating the expression in the ConstantItem
for a static item, the type is the Type from the StaticItem and the place represents the memory location represented by that static item
For a path that resolves to a local variable (or function parameter) things aren't so simple.
I suggest a reasonable approach for the Reference's current depth would be something along the following lines:
acknowledge that the notion of evaluating an expression isn't defined in isolation, but relative to an evaluation context
say that at runtime the evaluation context contains (at least) a chain of activation frames, corresponding to the functions which have been called and have not yet returned
say that an activation frame for a function contains a map from the function's local bindings to memory locations which are allocated when the function is called
say that for a path expression which resolves to a local binding the type is that binding's type, and the place represents the memory location that binding maps to in the last activation frame in the chain (which is necessarily an activation frame for the function containing the path expression).
I see that at present there is some wording about activation frames in the "return expressions" section, though nothing in "Call expressions".
The "Path expressions" section says:
"A path used as an expression context denotes either a local variable or an item.", and
"Path expressions that resolve to local or static variables are place expressions, other paths are value expressions.".
But it doesn't say how to get from an item or a local variable to a value or a place.
First, it should be saying that the path which makes up the expression is resolved in the value namespace.
Then it needs to cover each kind of entity that can appear in the value namespace, and explain how to use one to get a value or a place (and so also determine the expression's type).
For example:
for a function item, the type is the corresponding function item type and the value is that type's unique member
for a constant item, the type is the Type from the ConstantItem and the value is obtained by evaluating the expression in the ConstantItem
for a static item, the type is the Type from the StaticItem and the place represents the memory location represented by that static item
For a path that resolves to a local variable (or function parameter) things aren't so simple.
I suggest a reasonable approach for the Reference's current depth would be something along the following lines:
acknowledge that the notion of evaluating an expression isn't defined in isolation, but relative to an evaluation context
say that at runtime the evaluation context contains (at least) a chain of activation frames, corresponding to the functions which have been called and have not yet returned
say that an activation frame for a function contains a map from the function's local bindings to memory locations which are allocated when the function is called
say that for a path expression which resolves to a local binding the type is that binding's type, and the place represents the memory location that binding maps to in the last activation frame in the chain (which is necessarily an activation frame for the function containing the path expression).
I see that at present there is some wording about activation frames in the "
return
expressions" section, though nothing in "Call expressions".See also #949 and #1489, and ferrocene/specification#466 (which is an earlier writeup of this issue).
The text was updated successfully, but these errors were encountered: