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

Code review of the Ast #2941

Merged
merged 14 commits into from Oct 22, 2023
Merged

Code review of the Ast #2941

merged 14 commits into from Oct 22, 2023

Conversation

guizmaii
Copy link
Member

No description provided.

@guizmaii guizmaii changed the title Use more mutable data structures Code review Oct 21, 2023
@guizmaii guizmaii changed the title Code review Code review of the Ast Oct 22, 2023
@guizmaii guizmaii marked this pull request as ready for review October 22, 2023 07:20
}

//************************************************************

final class Infix(val parts: List[String], val params: List[Ast], val pure: Boolean, val transparent: Boolean)(
theQuat: => Quat
) extends Ast {
def quat: Quat = theQuat
Copy link
Member Author

Choose a reason for hiding this comment

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

A few theQuat calls weren't "cached" and were potentially re-computed many times

}

final class Ident private (val name: String)(theQuat: => Quat)(val visibility: Visibility) extends Terminal with Ast {
private lazy val computedQuat = theQuat
Copy link
Member Author

Choose a reason for hiding this comment

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

We don't need this computedQuat variable. the overrided def quat: Quat method can be just a lazy val

@@ -422,7 +425,7 @@ object Visibility extends OpinionValues[Visibility] {
}

sealed trait Renameable extends Opinion[Renameable] {
def fixedOr[T](plain: T)(otherwise: T) =
def fixedOr[T](plain: => T)(otherwise: => T): T =
Copy link
Member Author

Choose a reason for hiding this comment

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

This wasn't lazy enough. Always computing both sides even if one of them is never used

Base automatically changed from mutable_6 to master October 22, 2023 15:25
@juliano juliano merged commit 6eb5114 into master Oct 22, 2023
13 checks passed
@juliano juliano deleted the mutable_7 branch October 22, 2023 15:27
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.

None yet

2 participants