Implement lexical scoping with let expressions#307
Implement lexical scoping with let expressions#307jamesls wants to merge 1 commit intojmespath:developfrom
Conversation
See jmespath/jmespath.jep#18 for more details.
| "comment": "Bindings only visible within expression clause", | ||
| "expression": "let $a = 'top-a' in let $a = 'in-a', $b = $a in $b", | ||
| "result": "top-a" |
There was a problem hiding this comment.
Any reason why we don't want the bindings to update as they are being processed/created ?
It could be useful to allow referencing a binding previously declared.
There was a problem hiding this comment.
This would enable mutually recursive definitions, analogous to letrec in other languages. I'd rather have user defined functions be the mechanism to define that, if that ever ends up happening.
BTW, the best place for questions related to the spec would be on the tracking proposal.
There was a problem hiding this comment.
If variables are set up in the same order they are declared would this be subject to recursive definition ?
I mean $a is assigned first, then $b comes after that and uses $a, etc...
There was a problem hiding this comment.
I see the comments on the tracking proposal linked, moving the discussion over there.
See jmespath/jmespath.jep#18 for more details.
NOTE: The JEP is still in the review stage, and is subject to change. This PR won't be merged until the JEP is finalized and approved. I'm sending the PR now in case anyone wants to try it out and experiment with the feature in order to give better feedback.
I'm still going to be testing this more thoroughly, there might be some bugs. I did add the testcases from the JEP as part of this change, and those tests (along with the existing compliance tests) are all passing.