Hashes and keyword arguments

M

Martin DeMello

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
 
Y

Yukihiro Matsumoto

Hi,

In message "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?

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

matz.
 
M

Martin DeMello

Yukihiro Matsumoto said:
Hi,

In message "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?

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?

martin
 
Y

Yukihiro Matsumoto

Hi,

In message "Re: Hashes and keyword arguments"

|> 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Command Line Arguments 0
hashes 2
Keyword arguments for WIN32OLE? 4
Passing keyword arguments 6
Default values of hashes 7
Keyword parameters 2
Array of hashes issue 6
filtering keyword arguments 3

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top