Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@super #602

Open
marcelocantos opened this issue Aug 26, 2020 · 0 comments
Open

@super #602

marcelocantos opened this issue Aug 26, 2020 · 0 comments
Labels
enhancement P2 Low priority issue

Comments

@marcelocantos
Copy link
Contributor

marcelocantos commented Aug 26, 2020

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:

some_tuple_expr +> (y+>: @super -> (z+>: @super.w + .x))

equals:

some_tuple_expr -> . +> (y+>: (z+>: .y.w + .x))

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).

@marcelocantos marcelocantos changed the title super @super Aug 26, 2020
@orlade orlade added the P2 Low priority issue label Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement P2 Low priority issue
Projects
None yet
Development

No branches or pull requests

2 participants