another example of how this creates surprise, confusion and subtle bugs ~~~ruby def foo(a = 1, **options) end foo opt: 2 ~~~ _____________ if 'a' becomes mandatory, instead of raising, "a" will absorb the options, which is c...rits (First Last)
https://bugs.ruby-lang.org/issues/9291 is somewhat related foo(**nil) should not raise since foo(*nil) does not and it's the more useful behaviorrits (First Last)
irb(main):001:0> def foo; end; foo **{} ArgumentError: wrong number of arguments (1 for 0) note that splatting an empty array results in no arguments this behavior is particularly problematic with send (dispatching to different me...rits (First Last)
Tsuyoshi Sawada wrote: > I don't understand how `has_key?` is better I already explained it, all I can do is restate it. When the predicate consists of a just single noun or adjective, there is only enough information in it to ask...rits (First Last)
in the interest of maximizing the English readability and sensibility (self documentability) of predicates, it is key? that should be deprecated. when you have an instance method predicate in the form receiver.noun? this reads in Engl...rits (First Last)
Koichi Sasada wrote: > Sorry I missed this line. > ... having never studied the actual implementation, this is as concrete as I can make it "before keyword args are packaged into a hash which is bound to a mandatory param, actual fi...rits (First Last)
Koichi Sasada wrote: > (2014/08/16 12:49), meanlogin@gmail.com wrote: > ... I already stated what I think would make more sense: before keyword args are packaged into a hash which is bound to a mandatory param, actual first class ke...rits (First Last)
First Last wrote: > Nobuyoshi Nakada wrote: > ... this example is particularly illustrative, it's absurd to complain about missing keyword b when the method is being passed keyword b rits (First Last)
Nobuyoshi Nakada wrote: > Mandatory arguments have priority over keywords arguments. instead of just restating what is, why don't you say why it should be this way. before keyword args existed as first class citizens, it made sens...rits (First Last)