ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:55037] [ruby-trunk - Bug #8418][Open] when all params are optional, named arg hash maps to the first available param
@ 2013-05-17 23:20 rits (First Last)
  2013-05-17 23:29 ` [ruby-core:55038] [ruby-trunk - Bug #8418] " rits (First Last)
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: rits (First Last) @ 2013-05-17 23:20 UTC (permalink / raw
  To: ruby-core


Issue #8418 has been reported by rits (First Last).

----------------------------------------
Bug #8418: when all params are optional, named arg hash maps to the first available param
https://bugs.ruby-lang.org/issues/8418

Author: rits (First Last)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


irb(main):028:0> def foo(arg = 1, options = {}); {arg: arg, options: options}; end; foo(a: 1)
=> {:arg=>{:a=>1}, :options=>{}}

since positional args can't follow the named hash, perhaps the named hash should map to the last possible param?


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:55038] [ruby-trunk - Bug #8418] when all params are optional, named arg hash maps to the first available param
  2013-05-17 23:20 [ruby-core:55037] [ruby-trunk - Bug #8418][Open] when all params are optional, named arg hash maps to the first available param rits (First Last)
@ 2013-05-17 23:29 ` rits (First Last)
  2013-05-18  1:01 ` [ruby-core:55040] [ruby-trunk - Bug #8418][Rejected] " nobu (Nobuyoshi Nakada)
  2013-11-24 19:18 ` [ruby-core:58551] [ruby-trunk - Bug #8418] " rits (First Last)
  2 siblings, 0 replies; 4+ messages in thread
From: rits (First Last) @ 2013-05-17 23:29 UTC (permalink / raw
  To: ruby-core


Issue #8418 has been updated by rits (First Last).


that would also make it correspond to the new syntax

irb(main):034:0> def foo(arg = 1, **options); {arg: arg, options: options}; end; foo(a: 1)
=> {:arg=>1, :options=>{:a=>1}}


----------------------------------------
Bug #8418: when all params are optional, named arg hash maps to the first available param
https://bugs.ruby-lang.org/issues/8418#change-39390

Author: rits (First Last)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


irb(main):028:0> def foo(arg = 1, options = {}); {arg: arg, options: options}; end; foo(a: 1)
=> {:arg=>{:a=>1}, :options=>{}}

since positional args can't follow the named hash, perhaps the named hash should map to the last possible param?


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:55040] [ruby-trunk - Bug #8418][Rejected] when all params are optional, named arg hash maps to the first available param
  2013-05-17 23:20 [ruby-core:55037] [ruby-trunk - Bug #8418][Open] when all params are optional, named arg hash maps to the first available param rits (First Last)
  2013-05-17 23:29 ` [ruby-core:55038] [ruby-trunk - Bug #8418] " rits (First Last)
@ 2013-05-18  1:01 ` nobu (Nobuyoshi Nakada)
  2013-11-24 19:18 ` [ruby-core:58551] [ruby-trunk - Bug #8418] " rits (First Last)
  2 siblings, 0 replies; 4+ messages in thread
From: nobu (Nobuyoshi Nakada) @ 2013-05-18  1:01 UTC (permalink / raw
  To: ruby-core


Issue #8418 has been updated by nobu (Nobuyoshi Nakada).

Status changed from Open to Rejected

That's the reason that keyword argument is introduced.
----------------------------------------
Bug #8418: when all params are optional, named arg hash maps to the first available param
https://bugs.ruby-lang.org/issues/8418#change-39397

Author: rits (First Last)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


irb(main):028:0> def foo(arg = 1, options = {}); {arg: arg, options: options}; end; foo(a: 1)
=> {:arg=>{:a=>1}, :options=>{}}

since positional args can't follow the named hash, perhaps the named hash should map to the last possible param?


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:58551] [ruby-trunk - Bug #8418] when all params are optional, named arg hash maps to the first available param
  2013-05-17 23:20 [ruby-core:55037] [ruby-trunk - Bug #8418][Open] when all params are optional, named arg hash maps to the first available param rits (First Last)
  2013-05-17 23:29 ` [ruby-core:55038] [ruby-trunk - Bug #8418] " rits (First Last)
  2013-05-18  1:01 ` [ruby-core:55040] [ruby-trunk - Bug #8418][Rejected] " nobu (Nobuyoshi Nakada)
@ 2013-11-24 19:18 ` rits (First Last)
  2 siblings, 0 replies; 4+ messages in thread
From: rits (First Last) @ 2013-11-24 19:18 UTC (permalink / raw
  To: ruby-core


Issue #8418 has been updated by rits (First Last).


but isn't it good to have correspondence between keyword args and keyword hash?

when keyword args are used explicitly at invocation (foo a: 1, foo **hash) but the method signature does not use keyword params, it seems natural to bind the resulting hash to the last possible param, not the first
----------------------------------------
Bug #8418: when all params are optional, named arg hash maps to the first available param
https://bugs.ruby-lang.org/issues/8418#change-43130

Author: rits (First Last)
Status: Rejected
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p195 (2013-05-14 revision 40734) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


irb(main):028:0> def foo(arg = 1, options = {}); {arg: arg, options: options}; end; foo(a: 1)
=> {:arg=>{:a=>1}, :options=>{}}

since positional args can't follow the named hash, perhaps the named hash should map to the last possible param?


-- 
http://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-24 19:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-17 23:20 [ruby-core:55037] [ruby-trunk - Bug #8418][Open] when all params are optional, named arg hash maps to the first available param rits (First Last)
2013-05-17 23:29 ` [ruby-core:55038] [ruby-trunk - Bug #8418] " rits (First Last)
2013-05-18  1:01 ` [ruby-core:55040] [ruby-trunk - Bug #8418][Rejected] " nobu (Nobuyoshi Nakada)
2013-11-24 19:18 ` [ruby-core:58551] [ruby-trunk - Bug #8418] " rits (First Last)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).