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

Refactoring module_function #4931

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

Conversation

yui-knk
Copy link
Contributor

@yui-knk yui-knk commented Jan 2, 2018

Remove MODULE_FUNCTION from Visibility and
add isModuleFunction to Frame.
Implementing module_function as Visibility
makes the visibility of foo to be MODULE_FUNCTION:

Module.new do
  module_function
  define_method(:foo) {:foo}
end

module_function is not a type of visibility
but states of frames. So change to manage it
on Frame.

Copy link
Member

@enebo enebo left a comment

Choose a reason for hiding this comment

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

I think this change is clean but I do not think we want to pay resetting an additional field in Frame. This will have some measurable cost. We are trying to always prune down cost of frame management.

I wonder if we can somehow combine state of capture and this boolean together possibly something as icky as an Enum although maybe a module_function frame can also capture? bit flags combining would be another idea since neither flag is set by default. Just thinking out loud...

Remove `MODULE_FUNCTION` from `Visibility` and
add `isModuleFunction` to `Frame`.
Implementing `module_function` as `Visibility`
makes the visibility of `foo` to be `MODULE_FUNCTION`:

```
Module.new do
  module_function
  define_method(:foo) {:foo}
end
```

`module_function` is not a type of visibility
but states of frames. So change to manage it
on `Frame`.
@yui-knk yui-knk force-pushed the test_define_method_visibility_2 branch from 97e89a6 to 6a9aa24 Compare January 4, 2018 08:03
Introduce `FrameVisibility` to handle visibility of
methods and frames separately.
@yui-knk
Copy link
Contributor Author

yui-knk commented Jan 4, 2018

I introduced FrameVisibility, by this we can manage states of Frame without adding a new field to Frame.

enebo
enebo previously approved these changes Jan 16, 2018
Copy link
Member

@enebo enebo left a comment

Choose a reason for hiding this comment

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

I am ok with this change. I added @headius since changing Frame is our most sensitive class in our runtime.

@enebo enebo requested a review from headius January 16, 2018 15:05
@yui-knk
Copy link
Contributor Author

yui-knk commented Jan 17, 2018

I want to revert last commit, because last commit breaks many test cases...

@enebo
Copy link
Member

enebo commented Jan 17, 2018

@yui-knk do you know why they failed? Removal of that enum value?

@enebo enebo dismissed their stale review January 17, 2018 15:02

We need to resolve what broke from this PR

@enebo
Copy link
Member

enebo commented Jan 29, 2018

@yui-knk I am unsure from reading comments what is needed to move forward on this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants