On Thu, Oct 27, 2011 at 11:42 AM, Nobuyoshi Nakada <nobu / ruby-lang.org> wrote:
> You didn't know? ;)
>
> Anyway, isn't it better to show which default value was evaluated in
> the backtrace?

Yes, it definitely is. I would like to see Ruby do that for me, but
since it sounds like it won't...

this seems too long, and that's with a very short message:

def foo(a: raise(ArgumentError, 'missing a')))

I think this is better but ugly:

def foo(a: nil)
  raise ArgumentError, 'missing a' if a.nil?

The other problem with the second version is that nil might be a valid
value to pass in for a. So if Ruby doesn't enforce required keyword
args, you actually have to use this pattern:

def foo(a: (no_a = true; nil))
  raise ArgumentError, 'missing a' if no_a

Bleah.

- Charlie