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

Add "Smalltalk" conditionals #5

Merged
merged 2 commits into from Nov 6, 2015

Conversation

0x0dea
Copy link
Contributor

@0x0dea 0x0dea commented Nov 1, 2015

I think this is a pretty nifty way to simulate having multiple blocks in Ruby, but it's really not the kind of thing you'd want to find in a production environment.

@twe4ked
Copy link

twe4ked commented Nov 1, 2015

Maybe add the expected output?

@franzejr
Copy link
Owner

franzejr commented Nov 1, 2015

Yep, I was thinking about the output. Could you give us an output ?

@xzgyb
Copy link
Contributor

xzgyb commented Nov 3, 2015

Very interesting! 👍

@rafaelsales
Copy link
Collaborator

@0x0dea @franzejr

The code has an issue: we cannot call fail Math because Math is an object that does't inherit from any ruby exception class.

I would also suggest wrapping the params with parenthesis as it's recommended in ruby community style guide.

And finally, an expected output so that a reader don't have to run the file to see result.

So:

def  true.-(a, &b); a[] end
def false.-(a, &b); b[] end

puts (1 == 1).--> { :ok } { :different }
puts (4 == 2).--> { :ok } { :different }

# Result:
# ok
# different

@0x0dea
Copy link
Contributor Author

0x0dea commented Nov 6, 2015

@rafaelsales

Thank you for taking the time to make the purpose of the code a little clearer; I have updated this pull request with your version. For what it's worth, fail Math was intended to be humorous. 😆

@twe4ked
Copy link

twe4ked commented Nov 6, 2015

👍

rafaelsales added a commit that referenced this pull request Nov 6, 2015
@rafaelsales rafaelsales merged commit 2054831 into franzejr:master Nov 6, 2015
@rafaelsales
Copy link
Collaborator

Thanks @0x0dea !!!

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

5 participants