Assume a scenario where I have the following ballerina constructs:
type Node object {
int index;
Node parent?;
public function getParent() return Node {
return self.parent;
}
};
public function getRootNode() returns Node {
...
}
Scenario 1:
Node n = getRootNode();
n.index += 1;
I can make these two statements inlined:
getRootNode().index += 1; // not supported by the spec . ----(1)
Scenario 2:
Node n = ...;
n.getParent().index += 1; // not supported by the spec . ----(2)
Of-course both the scenarios can be achieved if I use two-steps. However I don't see any reason to limit the cases (1) and (2), as it complies and consistent to the syntax and the semantics of member-access/method-call expressions in other places.
Description:
Referring to the following sections of the spec:
Assume a scenario where I have the following ballerina constructs:
Scenario 1:
I can make these two statements inlined:
Scenario 2:
Of-course both the scenarios can be achieved if I use two-steps. However I don't see any reason to limit the cases (1) and (2), as it complies and consistent to the syntax and the semantics of member-access/method-call expressions in other places.