Hashes and keyword arguments

Will Ruby’s keyword arguments still be implemented by passing in a
hash internally? A problem just occurred to me - a duplicate key in a
hash simply overwrites the previous value; however, in an argument ilst
I’d want to flag it as an error. Is that possible?

martin

Hi,

···

In message “Hashes and keyword arguments” on 04/01/16, Martin DeMello martindemello@yahoo.com writes:

Will Ruby’s keyword arguments still be implemented by passing in a
hash internally? A problem just occurred to me - a duplicate key in a
hash simply overwrites the previous value; however, in an argument ilst
I’d want to flag it as an error. Is that possible?

It will be implemented using Hash. But duplicate key in a calling
argument list will be warned (or raise exception).

						matz.

Thanks - that’s reassuring. How does it work? Will the same exception be
available as an option for normal Hashes?

martin

···

Yukihiro Matsumoto matz@ruby-lang.org wrote:

Hi,

In message “Hashes and keyword arguments” > on 04/01/16, Martin DeMello martindemello@yahoo.com writes:

Will Ruby’s keyword arguments still be implemented by passing in a
hash internally? A problem just occurred to me - a duplicate key in a
hash simply overwrites the previous value; however, in an argument ilst
I’d want to flag it as an error. Is that possible?

It will be implemented using Hash. But duplicate key in a calling
argument list will be warned (or raise exception).

Hi,

···

In message “Re: Hashes and keyword arguments” on 04/01/17, Martin DeMello martindemello@yahoo.com writes:

It will be implemented using Hash. But duplicate key in a calling
argument list will be warned (or raise exception).

Thanks - that’s reassuring. How does it work? Will the same exception be
available as an option for normal Hashes?

Possible for hash literals.

						matz.