Skip to content

Remove ExprAppSingleParenArgNode from Oak model. - #2994

Closed
nojaf wants to merge 3 commits into
fsprojects:mainfrom
nojaf:app-clean-up
Closed

nojaf wants to merge 3 commits into
fsprojects:mainfrom
nojaf:app-clean-up

Conversation

@nojaf

@nojaf nojaf commented Nov 20, 2023

Copy link
Copy Markdown
Contributor

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 SyntakOak should "strictly" not have any knowledge of how CodePrinter deals with the details of the captured nodes.

Right now: f(g) is represented as ExprAppSingleParenArgNode while it could have easily been an ExprAppNode. We make the distinction based on what we are about to do with it in CodePrinter.

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 expr should 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 have ExprInfixApp and others. As a rule of thumb, I think we should try and keep style out of SyntaxOak. So groupings like Expr.AppLongIdentAndSingleParenArg and Expr.AppWithLambda should be ported to CodePrinter instead.

//cc @dawedawe @josh-degraw

/// Example: myFunc a b c
| Regular of appNode: ExprAppNode

// TODO: memoize function based on the range of appNode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is memoizing something you'd like specific to this task, or is that a general improvement you'd like to make at some point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@nojaf

nojaf commented Feb 8, 2024

Copy link
Copy Markdown
Contributor Author

Meh

@nojaf nojaf closed this Feb 8, 2024
@nojaf
nojaf deleted the app-clean-up branch August 28, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants