Repository navigation
Conversation
josh-degraw
reviewed
Nov 22, 2023
| /// Example: myFunc a b c | ||
| | Regular of appNode: ExprAppNode | ||
|
|
||
| // TODO: memoize function based on the range of appNode |
Contributor
There was a problem hiding this comment.
Is memoizing something you'd like specific to this task, or is that a general improvement you'd like to make at some point?
Contributor
Author
There was a problem hiding this comment.
Specifically in this case.
During the pipeline of CodePrinter on multiple occasions, we need to transform ExprAppNode to AppNode. This transformation is always going to be the same (in a single run), so it should not be recalculated each time we invoke the function.
Contributor
Author
|
Meh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an example of something I mentioned in comment.
I'm not quite sure if this improves things and we should merge this.
But my reasoning is that
SyntakOakshould "strictly" not have any knowledge of howCodePrinterdeals with the details of the captured nodes.Right now:
f(g)is represented asExprAppSingleParenArgNodewhile it could have easily been anExprAppNode. We make the distinction based on what we are about to do with it inCodePrinter.I'm not sure that this is a good reason to do it. It covers the representation of the typed code just as well. The significance of arguments being a single
paren exprshould be kept inside of CodePrinter, where it actually matters.This PR also isn't a plea to move everything back into
ExprAppNode. I still think it makes a lot of sense to haveExprInfixAppand others. As a rule of thumb, I think we should try and keep style out ofSyntaxOak. So groupings likeExpr.AppLongIdentAndSingleParenArgandExpr.AppWithLambdashould be ported toCodePrinterinstead.//cc @dawedawe @josh-degraw