Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Comments

Code review of the Ast#2941

Merged
juliano merged 14 commits intomasterfrom
mutable_7
Oct 22, 2023
Merged

Code review of the Ast#2941
juliano merged 14 commits intomasterfrom
mutable_7

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


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
@juliano juliano deleted the mutable_7 branch October 22, 2023 15:27
jilen pushed a commit that referenced this pull request Jun 11, 2024
* Use more mutable data structures

* Use more mutable data structures

* Use more mutable data structures

* Use more mutable data structures

* clean

* clean

* clean

* clean

* Fix compilation

* Avoid allocations

* scalafmt

* clean

* scalafmt

* more lazy
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