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. :)
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:
So, in order for that snippet to work, I have to pass some value (empty hash) to the
#callmethod.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
nilas default value protocol makes unexpected decision for me.Thanks in advance, waiting for your comments. :)