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

Clean up define method #3617

Merged
merged 12 commits into from Feb 8, 2016
Merged

Clean up define method #3617

merged 12 commits into from Feb 8, 2016

Conversation

tak1n
Copy link
Member

@tak1n tak1n commented Feb 5, 2016

First I tried to ship most of the logic towards executables and use Method#for_define_method and UnbindMethod#for_define_method as thin wrapper around Executable#for_define_method.
The result can be seen here: 7cd4315

When the need to support Proc again came up it was clear that shipping most of the stuff into executables was not quite doable, or at least I was not able to do it properly.
Therefore I moved it up into Method and UnboundMethod where again we have nested conditionals (but at least no more nested conditionals in a big fat case statement)

As for BlockEnvironment::AsMethod#scope I'm not sure if this should return nil or the scope of @block_env. In the previous implementation define_method for a BlockEnvironment::AsMethod executable used nil as scope. Also when changing it to @block_env.scope all ci specs are still passing so probably this means there are missing specs for that.

@tak1n
Copy link
Member Author

tak1n commented Feb 6, 2016

Regarding to d59ca90

My reasoning behind this was this code part in the previous impl:
https://github.com/rubinius/rubinius/pull/3617/files#diff-b654709dae0e13be432ffb42c94a555eL454

We used the block scope after duping the proc but also we duped the block first.
Which is kinda confusing for me, so I probably need some confirmation if the new impl is doing the same (at least all specs still pass) but confirmation from @brixen, @yorickpeterse or anybody else who is confident enough about this stuff would be much appreciated.

@brixen
Copy link
Member

brixen commented Feb 7, 2016

@tak1n this is a great first step, thanks for working on it. We'll continue to evolve some of these APIs to be even more simple. If you feel confident with this now, go ahead and merge, please! 👍

tak1n added a commit that referenced this pull request Feb 8, 2016
@tak1n tak1n merged commit e2d1437 into master Feb 8, 2016
@yorickpeterse yorickpeterse deleted the clean_up_define_method branch February 8, 2016 09:23
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