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

Default value for env is nil. Why? :) #10

Open
glebglazov opened this issue Mar 6, 2018 · 0 comments
Open

Default value for env is nil. Why? :) #10

glebglazov opened this issue Mar 6, 2018 · 0 comments

Comments

@glebglazov
Copy link

glebglazov commented Mar 6, 2018

Hi guys.

Do we have some kind of motivation to set the value of env to nil?

Cause, to my mind, it makes some features of current Ruby usable only in certain ways.

For example - keyword arguments:

Middleware::Builder.new do |b|
  b.use -> (a: 1, b: 3) { p a, b }
end.call

So, in order for that snippet to work, I have to pass some value (empty hash) to the #call method.
That snippet would fail due to the fact, that default argument is nil.

The second aspect is about explicitness of what we're trying to achieve. With nil as default value protocol makes unexpected decision for me.

Thanks in advance, waiting for your comments. :)

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