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

Refactor Content.rec(..) function to support tail-optimisation #417

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

dmytroDragan
Copy link

What is the context for this pull request?

What changes were proposed in this pull request?

Refactor Content.rec(..) function to support tail-optimisation

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added unit tests

* @return Result list of applying function to all files
*/
def recFilesApply[T](
prefixPath: Path,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you try this if you are using intellij?
Setting => editor => coding style => scala

  • formatter -> scalafmt
  • configuration -> dev\.scalafmt.conf

ctrl + alt + l

ddrag and others added 3 commits April 26, 2021 16:01
reduce visibility scope for recFilesApply

Co-authored-by: EJ Song <51077614+sezruby@users.noreply.github.com>
Co-authored-by: EJ Song <51077614+sezruby@users.noreply.github.com>
* @tparam T
* @return Result list of applying function to all files
*/
private[hyperspace] def recFilesApply[T](
Copy link
Collaborator

@sezruby sezruby Apr 30, 2021

Choose a reason for hiding this comment

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

Could you move this function back to case class Content? as this is a private function that should be only used in case class Content.

Other than that, this change looks good to me :) Could you rebase this PR onto master?

Copy link
Author

Choose a reason for hiding this comment

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

Hi, sorry for delay. I consider it as just static function, so it could live separately from class. It also simplify testing

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with this being a generic utility function, but:

  1. The name recFilesApply seems unusual. Maybe applyToFilesRecursively?
  2. The meaning of "prefix" here seems unclear. What is the "root prefix" and what is the "current prefix"? Without looking at the code, it is hard to catch the meaning of the parameters.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks @clee704. Valid point, I have inherited prefixPath from original function. I have changed it to just path and added a short description why we need it

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

3 participants