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

Change delegate macro to be delegate *methods, to: object #2786

Merged
merged 1 commit into from
Jun 10, 2016

Conversation

asterite
Copy link
Member

@asterite asterite commented Jun 9, 2016

This is the way I wanted delegate to work in the first place, though the language couldn't express that.

This is a breaking change, but it makes code easier to read and understand:

delegate foo, bar, baz
# vs.
delegate foo, bar, to: baz

Additionally, an extra overload that receives a block is added, which forwards all block arguments, so this covers now all cases except that when a block is captured.

@@ -730,7 +730,7 @@ class String
end

def at(index : Int)
at(index) { raise IndexError }
at(index) { raise IndexError.new }
Copy link
Member

Choose a reason for hiding this comment

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

Why this change is here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, it was wrong. Maybe I should commit the fix to master instead :-P

@asterite asterite force-pushed the feature/delegate_to branch from 649afa6 to d3ae73e Compare June 9, 2016 19:09
@asterite asterite force-pushed the feature/delegate_to branch from d3ae73e to 1cbb700 Compare June 9, 2016 22:54
@asterite asterite merged commit 353eeb1 into master Jun 10, 2016
@asterite asterite deleted the feature/delegate_to branch June 10, 2016 13:18
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

3 participants