On Thu, Oct 27, 2011 at 3:16 AM, Nobuyoshi Nakada <nobu / ruby-lang.org> wrote:
> (11/10/27 11:02), Charles Oliver Nutter wrote:
>> def foo(a: nil)
>>  raise ArgumentError, 'must pass value for a' unless a
>>  ..
>> end
>
> It should be a positinal argument. I can't get why it must be a
> keyword argument.

It's a contrived example, of course, but I think having a neat
parallel between positional args (required, optional, rest) and
keyword args (required, optional, rest) would serve users well.

Honestly, I'm not one to argue for increased complexity in argument
processing...the 1.9 support for array destructuring still gives me
nightmares. But in this case, it seems like having keyword args mirror
positional args is a good idea.

>> So in essence, by making all keyword arguments optional, you're
>> forcing users to do their own required argument checks. Is that going
>> to make programmers happy?
>
> An alternative:
> def foo(a: raise(ArgumentError))
> end

You are an evil, evil man. :)

- Charlie