ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not
@ 2013-12-24 10:17 rits (First Last)
  2013-12-27 17:49 ` [ruby-core:59347] [ruby-trunk - Bug #9291] " rits (First Last)
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: rits (First Last) @ 2013-12-24 10:17 UTC (permalink / raw
  To: ruby-core


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

----------------------------------------
Bug #9291: array splatting a nil works, but hash splatting a nil does not
https://bugs.ruby-lang.org/issues/9291

Author: rits (First Last)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN


irb(main):001:0> [*nil]
=> []
irb(main):002:0> {**nil}
TypeError: no implicit conversion of nil into Hash



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

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

* [ruby-core:59347] [ruby-trunk - Bug #9291] array splatting a nil works, but hash splatting a nil does not
  2013-12-24 10:17 [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not rits (First Last)
@ 2013-12-27 17:49 ` rits (First Last)
  2014-08-04 14:48 ` [ruby-core:64191] " meanlogin
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rits (First Last) @ 2013-12-27 17:49 UTC (permalink / raw
  To: ruby-core


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


this could be used like this: method a: 1, **({b: 1} if condition)
----------------------------------------
Bug #9291: array splatting a nil works, but hash splatting a nil does not
https://bugs.ruby-lang.org/issues/9291#change-43921

Author: rits (First Last)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 
ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN


irb(main):001:0> [*nil]
=> []
irb(main):002:0> {**nil}
TypeError: no implicit conversion of nil into Hash



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

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

* [ruby-core:64191] [ruby-trunk - Bug #9291] array splatting a nil works, but hash splatting a nil does not
  2013-12-24 10:17 [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not rits (First Last)
  2013-12-27 17:49 ` [ruby-core:59347] [ruby-trunk - Bug #9291] " rits (First Last)
@ 2014-08-04 14:48 ` meanlogin
  2014-08-11  9:42 ` [ruby-core:64296] " ruby-core
  2019-12-18 10:26 ` [ruby-core:96304] [Ruby master Bug#9291] " mame
  3 siblings, 0 replies; 5+ messages in thread
From: meanlogin @ 2014-08-04 14:48 UTC (permalink / raw
  To: ruby-core

Issue #9291 has been updated by First Last.


So is there a reason * and ** should work differently for nil?


----------------------------------------
Bug #9291: array splatting a nil works, but hash splatting a nil does not
https://bugs.ruby-lang.org/issues/9291#change-48192

* Author: First Last
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
irb(main):001:0> [*nil]
=> []
irb(main):002:0> {**nil}
TypeError: no implicit conversion of nil into Hash




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

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

* [ruby-core:64296] [ruby-trunk - Bug #9291] array splatting a nil works, but hash splatting a nil does not
  2013-12-24 10:17 [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not rits (First Last)
  2013-12-27 17:49 ` [ruby-core:59347] [ruby-trunk - Bug #9291] " rits (First Last)
  2014-08-04 14:48 ` [ruby-core:64191] " meanlogin
@ 2014-08-11  9:42 ` ruby-core
  2019-12-18 10:26 ` [ruby-core:96304] [Ruby master Bug#9291] " mame
  3 siblings, 0 replies; 5+ messages in thread
From: ruby-core @ 2014-08-11  9:42 UTC (permalink / raw
  To: ruby-core

Issue #9291 has been updated by Marc-Andre Lafortune.

Assignee set to Yukihiro Matsumoto

Currently, `*` uses explicit conversion to array (`to_a`, not `to_ary`), while `**` uses implicit conversion to hash (`to_hash`, not `to_h`).

So your question about `nil` can be explained this way, since `nil.to_a #=> []` but `nil.to_hash` is not defined.

The real question is then: shouldn't `**` be using explicit conversion to hash with to_h?

----------------------------------------
Bug #9291: array splatting a nil works, but hash splatting a nil does not
https://bugs.ruby-lang.org/issues/9291#change-48279

* Author: First Last
* Status: Open
* Priority: Normal
* Assignee: Yukihiro Matsumoto
* Category: 
* Target version: 
* ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
* Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
irb(main):001:0> [*nil]
=> []
irb(main):002:0> {**nil}
TypeError: no implicit conversion of nil into Hash




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

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

* [ruby-core:96304] [Ruby master Bug#9291] array splatting a nil works, but hash splatting a nil does not
  2013-12-24 10:17 [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not rits (First Last)
                   ` (2 preceding siblings ...)
  2014-08-11  9:42 ` [ruby-core:64296] " ruby-core
@ 2019-12-18 10:26 ` mame
  3 siblings, 0 replies; 5+ messages in thread
From: mame @ 2019-12-18 10:26 UTC (permalink / raw
  To: ruby-core

Issue #9291 has been updated by mame (Yusuke Endoh).

Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN)
Status changed from Open to Rejected

Closing as it is by design.  If you want the change, please open a feature request ticket with a use case.

----------------------------------------
Bug #9291: array splatting a nil works, but hash splatting a nil does not
https://bugs.ruby-lang.org/issues/9291#change-83210

* Author: rits (First Last)
* Status: Rejected
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
* ruby -v: ruby 2.0.0p353 (2013-11-22 revision 43784) [i686-linux]
* Backport: 
----------------------------------------
irb(main):001:0> [*nil]
=> []
irb(main):002:0> {**nil}
TypeError: no implicit conversion of nil into Hash




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

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

end of thread, other threads:[~2019-12-18 10:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-24 10:17 [ruby-core:59297] [ruby-trunk - Bug #9291][Open] array splatting a nil works, but hash splatting a nil does not rits (First Last)
2013-12-27 17:49 ` [ruby-core:59347] [ruby-trunk - Bug #9291] " rits (First Last)
2014-08-04 14:48 ` [ruby-core:64191] " meanlogin
2014-08-11  9:42 ` [ruby-core:64296] " ruby-core
2019-12-18 10:26 ` [ruby-core:96304] [Ruby master Bug#9291] " mame

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