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

Should block params be allowed in construtors invocations too? #23

Open
samuelgoto opened this issue Nov 29, 2017 · 0 comments
Open

Should block params be allowed in construtors invocations too? #23

samuelgoto opened this issue Nov 29, 2017 · 0 comments

Comments

@samuelgoto
Copy link
Owner

samuelgoto commented Nov 29, 2017

Interesting use case in constructors for Ruby:

https://mixandgo.com/blog/mastering-ruby-blocks-in-less-than-5-minutes

let car = new Car() {
  ::color = 1;
  ::size = "large";
}

Could that lead to something like abstract classes?

sort([2, 3, 1, 4], new Comparator() {
  ::compare do (a, b) {
    return a < b;
  }
})

Are there enough use cases that makes this motivated enough? If so, which are the most compelling ones?

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

No branches or pull requests

1 participant