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

Adds an “if” method to Bool. #3430

Closed
wants to merge 1 commit into from
Closed

Conversation

Lukc
Copy link

@Lukc Lukc commented Oct 17, 2016

No description provided.

Verified

This commit was signed with the committer’s verified signature.
@RX14
Copy link
Member

RX14 commented Oct 17, 2016

Thanks for the contribution, however I think this reads too much like postfix if to have the complete opposite meaning.

@refi64
Copy link
Contributor

refi64 commented Oct 17, 2016

Is there a particular reason you can't just do:

my_result = if xyz
  puts 123
end

@asterite
Copy link
Member

@Lukc Thank you for this proposal, but using the if keyword is enough for your purposes and it's easier to read and write.

@asterite asterite closed this Oct 17, 2016
@Lukc
Copy link
Author

Lukc commented Oct 17, 2016

There was no particular reason, I guess. Though one may argue that having conditions implemented as methods would make the language “purer” (from an OOP point of view), I was mostly interested in the community’s opinion on actually implementing and/or using it.

Thank you for the quick answer. :)

@asterite
Copy link
Member

@Lukc I know Smalltalk is like that, but I don't think we can make everything pure, or if it's worth it. I prefer to sacrifice a bit of purity for the sake of readability.

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

4 participants