On Wed, Oct 26, 2011 at 2:08 PM, Yukihiro Matsumoto <matz / ruby-lang.org>wrote:

> Hi,
>
> In message "Re: [ruby-core:40414] Re: [ruby-trunk - Feature
> #5474][Assigned] keyword argument"
>     on Thu, 27 Oct 2011 02:51:51 +0900, Charles Oliver Nutter <
> headius / headius.com> writes:
>
> |Evan and I would like to see support for non-default keyword args. So
> |the following form would require that "size" be provided as a keyword
> |arg, and otherwise raise an ArgumentError:
> |
> |def create_point(x, y, color: "white", size:)
>
> I don't know the reason why you need this value-less keyword
> argument.  If you want the default value, you just need to omit the
> keyword altogether.
>

I think the point is that not every argument necessarily has a reasonable
default. Imagine, for example, if we were to rewrite File.open to take
keyword arguments:

    class File
      def self.open(filename:, mode: 'r')
      ...

It would be desirable to call such a method as `File.open(filename:
"foo.txt")` but omitting the "filename:" argument should be an error.
Perhaps, if a hash-like syntax is desired, we could introduce a "required"
keyword:

    class File
      def self.open(filename: required, mode: 'r')
      ...

such that omitting the option raises an ArgumentError?