Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

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-ai-dragonfly 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

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants