Please do not post any internal, closed source snippets on this public issue tracker!
Purpose
Please describe the end goal you are trying to achieve that has led you to request this feature.
As an extension to #485, support the special value @super, which refers to the lhs of a merge, either regular (some_tuple +> (y: @super.x + 1) equals some_tuple +> (y: some_tuple.x + 1)) or within special tuple/dict syntax (a +> (y+>: @super.x)) equals a +> (y+>: a.x))).
Chaining is not supported. Referring up the tree requires capturing in let forms:
While the above hardly looks like an improvement, the existing syntax is still obviously not as clean
@super is purely a lexical construct. It is not part of the data model or execution model. Consequently, the following wouldn't work, because @super doesn't mean anything in the context in which it appears:
let merger = (y: @super.x + 1);
some_tuple +> merger
Suggested approaches
What have you tried, and how might this problem be solved?
The name @super was inspired by Jsonnet, from which this concept is lifted. A better name might be @lhs. I even considered just @, but I want to reserve that in case we implement the equivalent of Jsonnet's self, though that seems unlikely at this stage, since (a: 1, b: @.a + 1) can be trivially refactored as let a = 1; (:a, b: a + 1).
Please do not post any internal, closed source snippets on this public issue tracker!
Purpose
As an extension to #485, support the special value
@super
, which refers to the lhs of a merge, either regular (some_tuple +> (y: @super.x + 1)
equalssome_tuple +> (y: some_tuple.x + 1)
) or within special tuple/dict syntax (a +> (y+>: @super.x))
equalsa +> (y+>: a.x))
).Chaining is not supported. Referring up the tree requires capturing in
let
forms:equals:
While the above hardly looks like an improvement, the existing syntax is still obviously not as clean
@super
is purely a lexical construct. It is not part of the data model or execution model. Consequently, the following wouldn't work, because@super
doesn't mean anything in the context in which it appears:Suggested approaches
The name
@super
was inspired by Jsonnet, from which this concept is lifted. A better name might be@lhs
. I even considered just@
, but I want to reserve that in case we implement the equivalent of Jsonnet'sself
, though that seems unlikely at this stage, since(a: 1, b: @.a + 1)
can be trivially refactored aslet a = 1; (:a, b: a + 1)
.