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

Closes #51. Implement Splats #71

Merged
merged 2 commits into from
Dec 10, 2017
Merged

Closes #51. Implement Splats #71

merged 2 commits into from
Dec 10, 2017

Conversation

faultyserver
Copy link
Member

Simple Splats are now supported for use as Call arguments, List literal elements, and for general use. They are implemented using a unary * method definition on the receiving object.

Splats currently enforce that the result of calling the unary * method will be a List value. I'm not sure if this is entirely desirable, but it can be changed in the future if it is not. #51 may be a place to continue discussion on this.

Additionally, an implementation of the splat operation for Lists has been added to support the most common usecase:

def foo(a, b, c)
  a + b + c
end

foo(*[1, 2, 3]) #=> 6

Simple Splats are now supported for use as Call arguments, List literal elements, and for general use. They are implemented using a unary `*` method definition on the receiving object.

Splats currently enforce that the result of calling the unary `*` method will be a List value. I'm not sure if this is entirely desirable, but it can be changed in the future if it is not.
`List` now implements the splat operation and simply returns itself.
@faultyserver faultyserver added this to the Next milestone Dec 10, 2017
@faultyserver faultyserver merged commit 5c3d110 into master Dec 10, 2017
@faultyserver faultyserver deleted the 51_splats branch December 10, 2017 23:44
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.

1 participant