Skip to content

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

Description

@glebglazov

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. :)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions